Bug Tracker

Opened 6 years ago

Closed 6 years ago

#13816 closed feature (notabug)

Provide a way to easily check if the browser is compatible with the used version of jQuery

Reported by: vinczemarton@… Owned by: vinczemarton@…
Priority: undecided Milestone: None
Component: unfiled Version: 2.0.0
Keywords: Cc:
Blocked by: Blocking:

Description

At the moment jQuery 2.0 can be used with no real drawbacks, as oldie compatibility can be easily provided by using IE conditional comments.

I have read in the jQuery 2.0 release announcement that there is a plan to drop old android browser support.

I personally use a custom android 2.3 rom on my phone (as it provides humongous battery life), and I use the stock browser from time to time (as it renders more consistently than opera mini, and is smoother than all other alternatives).

I have realized that I will not be able to use jQuery 2.0 and still fall back 1.9 on old android browsers as easily as conditional comments go.

Please provide a solution for this.

For example using yepnope like this would be great:

yepnope({
  test : jQuerySupport('2.0'),
  yep  : 'jquery.2.0.0.min.js',
  nope : ['polyfill.js', 'wrapper.js']
});

Change History (3)

comment:1 Changed 6 years ago by vinczemarton@…

I cannot edit my code as I'm posting as anonymous but clearly I wanted to write:

yepnope({
  test : jQuerySupport('2.0'),
  yep  : 'jquery.2.0.0.min.js',
  nope : 'jquery.1.9.1.min.js'
});

or since yepnope is usually used in the modernizr bundle:

Modernizr.load({
  test : jQuerySupport('2.0'),
  yep  : 'jquery.2.0.0.min.js',
  nope : 'jquery.1.9.1.min.js'
});

comment:2 Changed 6 years ago by m_gol

Owner: set to vinczemarton@…
Status: newpending

It's not possible to easily test if a particular browser is supporting jQuery code enough so that it should work. The only way to do what you ask for is to use user agent sniffing which is a definite no-go in jQuery core.

If you see any other way to do it, please post, but IMHO this is a wontfix.

Also, note that we didn't say Android 2.3 will soon be dropped, we'll wait for its user share to drop significantly first which will take some time.

comment:3 Changed 6 years ago by dmethvin

Resolution: notabug
Status: pendingclosed

At the moment, older Android is supported so it's a little early to talk about how to do something we don't need to do.

As the author of the page, you should either ensure that there are no oldIE users or use jQuery 1.9 when appropriate. As far as a last-ditched "you're screwed" message, a quick check might be:

if ( window.attachEvent && !window.addEventListener ) {
  alert(
    "Your browser won't work with this site.\n"+
    "Contact the site to ask if they support your browser."
  );
}

There isn't much that can be done if jQuery 2.x is loaded for oldIE, it just won't work and won't even initialize properly.

Note: See TracTickets for help on using tickets.