cowboy/jquery-hashchange

$.browser is undefined

thany opened this issue · 10 comments

I'm getting this error:

TypeError: $.browser is undefined
Line 300

Hashchange 1.3
jQuery 2.1.0
Firefox 27 (this won't matter, but just for completeness)

I think the error speaks for itself.

I got that issue too, and followed this fix:
For quick fix use this code:
change line 223:

  • if ($.browser.msie && parseInt(jQuery.browser.version) == 6) {
  • if (navigator.userAgent.match(/msie [6]/i)) {

I found it here: https://drupal.org/node/1961178

This is likely due to $.browser being removed in jquery 1.9. http://api.jquery.com/jquery.browser/

@msmuenchen It's not likely, it's definately ;)

@MxrBlind I'm not sure checking for IE6 specifically is enough. The fallback is needed for IE7 and IE8 as well, iirc.

Otoh, jQuery is about to drop IE6&7 support fairly soon, a so check for IE8 only might prove sufficient in the near future.

Short term solution like "if ($.browser && ..." ?
Long term ? I dont know if we need to be backward compatible.

Yeah, if you leave issues be for long enough, they will disspear by themselves. In this case, the whole hashchange plugin has become obsolete now they many folks are supporting IE 9 and up.

Here's an idea: check jQuery version. Folks using jQuery 2.x will not be supporting IE8 and lower, so when jQuery 2.x is loaded, skip everything. When 1.x is loaded, do whatever Modernizr does.

so what we can do?? Don't always use jquery version low 1.9 or use jquery migrate plugs ?? I think bast way is change origin code

thany commented

Just don't use this plugin and use the native hashchange event. With many of our projects supporting no MSIE at all, the need for IE-specific code has gone down the toilet. Microsoft has deemed MSIE deprecated as well, in favour of Edge. And so should you.

Just don't use this plugin and use the native hashchange event.

This should be the first line of the README.