5

The design template I am using needs jQuery 1.9. But Drupal 7 doesn't seem to support 1.9. Please correct me if I'm wrong The issue is that when in import jQuery 1.9 in Drupal 7 then here is the following error when in admin (overlay) trying to add content:

 Uncaught TypeError: Cannot read property 'msie' of undefined

This is coming from overlay-parent.js. It has the following code:

if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 8) {

It's causing an error because I am importing jQuery 1.9 and Drupal 7 runs code that contains the deprecated and removed jQuery.browser method.

The problem is that, after updating the code in modules/overlay/overlay-parent.js to:

if (navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/7/)) {

These changes are not taking effect. Perhaps this has to be compiled into some minimized .js file but I am not sure. How to make these changes in Drupal 7? Any alternative ways to make jQuery 1.9 compatible Drupal 7?

2
  • If you have not turned on JS aggregation no need to minify js. To debug you can always print out navagator.userAgent to check if its working or not. Also as David mentioned, there might be other code which are using deprecated code. To check that you can use jQuery.migrate plugin. It will indicate in console places where deprecated code are used.
    – GoodSp33d
    Jun 10 '13 at 7:18
  • Thank you 2-Stroker...the suggestion of JQuery.migrate worked very well
    – latvian
    Feb 1 '14 at 23:09
2

Drupal ships with a particular version of jQuery.

Using a different version of jQuery means refactoring various core javascript code.

If you want to use a more recent jQuery version, you can check the available versions provided by the jquery_update module which provides that refactored replacement javascript.

0
0

I had the same problem, I didn't want use lower Jquery version, so I resolve problem with #2 tiny patch in this page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.