cowboy / jquery-hashchange

This jQuery plugin enables very basic bookmarkable #hash history via a cross-browser HTML5 window.onhashchange event.
http://benalman.com/projects/jquery-hashchange-plugin/
GNU General Public License v2.0
1.22k stars 258 forks source link

$.browser is undefined #42

Open thany opened 10 years ago

thany commented 10 years ago

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.

MxrBlind commented 10 years ago

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

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

msmuenchen commented 10 years ago

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

thany commented 10 years ago

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

thany commented 10 years ago

@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.

alexandrehebert commented 10 years ago

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

thany commented 10 years ago

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.

ghost commented 7 years ago

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 7 years ago

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.

vinh28193 commented 6 years ago

Remove use of $.browser (removed in jQuery 1.9) and use regex it work 👍

keithws commented 6 years ago

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

This should be the first line of the README.