Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently when using with jQuery >= 1.9, Firebug will capture a JS error message as below:
TypeError: $.browser is undefined
As refer to http://api.jquery.com/jQuery.browser/:
Description: Contains flags for the useragent, read from navigator.userAgent. This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. Please try to use feature detection instead.
A dirty workaround patch attached to remove the usage of $.browser; As a better alternative, we may consider using http://api.jquery.com/jquery.support/ instead?
Comments
Comment #1
hswong3i CreditAttribution: hswong3i commentedComment #3
hswong3i CreditAttribution: hswong3i commentedComment #4
hswong3i CreditAttribution: hswong3i commentedComment #5
hswong3i CreditAttribution: hswong3i commentedComment #7
axe312 CreditAttribution: axe312 commentedPatch is working :)
Comment #8
fietserwin+1 on RTBC for the patch. Tested it in IE(11) and even there it works.
Comment #9
gaetanpru CreditAttribution: gaetanpru commentedThanks for patch, it's working for me too
Comment #10
Kgaut CreditAttribution: Kgaut commentedI can confirm too that the patch is working.
+1 for RTBC
Comment #11
XTazPatch working for me too.
Thanks
Comment #12
NitebreedBetter than stripping out functionality, we want a substitute for $.browser.
See attached patch
Comment #13
NitebreedComment #15
fietserwinLooking at what is done within the if statements, I really wonder why it was put in an if to start with? Is adding or removing a class browser dependent? I think not\, so it may be the processing done after adding or removing a class, does that throw errors (and thus invalidate all other js on the page) or is just not functioning. In both cases I would have expected some comments. Unfortunately they are not there, so let's just remove the if's.
Comment #16
knalstaaf CreditAttribution: knalstaaf commentedjQuery 1.10 is now the default for jQuery update (and many modules with it). Shouldn't we anticipate on 1.11 (which is already out) or at least 1.10?
Comment #17
rpsuIE8 and below seem to work weirdly unexpected ways (based on http://forum.jquery.com/topic/addclass-not-working-in-ie, however I did not test this thoroughly).
Apparently the worst thing that could happen is IE just not adding the given class to DOM. From that perspective these
if
's can be removed.This patch does remove those if's in the js-file. Please test this for IE8 and below.
Comment #18
rfayThis solves the (serious) problem for me (Chrome 45.0.2454.93 (64-bit), visiting a google maps API page). Marking RTBC, as it's important to solve this serious problem.
Comment #19
Arne Slabbinck CreditAttribution: Arne Slabbinck commentedPatch #17 fixed following error for me
Uncaught TypeError: Cannot read property 'msie' of undefined
Thx!
Comment #20
yogaf CreditAttribution: yogaf commentedPlease commit.
Patch #17 works.
Thank you.
Comment #22
SebCorbin CreditAttribution: SebCorbin commentedActually went with #4 as we do not really know why this was set at first, as said #15
Feel free to reopen another issue if issues are encountered with that change.
Comment #24
Brn CreditAttribution: Brn commentedAnother method :
- download JQuery Browser plugin https://plugins.jquery.com/browser/
- make your "custom" module
- put the "jquery.browser.js" file in your "custom" module folder
- call this js plugin file by adding code in "custom/custom.module" :