Hi all,

IMCE can use front JS configuration: for example, if your front theme is using jQuery 1.9... IMCE doesn't work.

imce/js/imce.js, line 792:
$.browser.msie && $('html').addClass('ie') && parseFloat($.browser.version) < 8 && $('html').addClass('ie-7');

jQuery 1.9 relase note:
The jQuery.browser() method has been deprecated since jQuery 1.3 and is removed in 1.9. If needed, it is available as part of the jQuery Migrate plugin. We recommend using feature detection with a library such as Modernizr.

So:
Horodatage : 22/04/2013 16:21:35
Erreur : TypeError: $.browser is undefined

We should edit imce.js to be compatible with jQuery 1.9 and higher (and keep compatibilité with anterior versions).
I'm sorry, i don't know very well imce.js and i don't see exactly the impacts when removing line 792 so i can't propose anything. But I would like a patch to me. :p

Drupaling yours.

Comments

ufku’s picture

Category: bug » support

Neither drupal core nor jquery_update module provides jQuery1.9. I don't think it will be an option for D7. We'll sure revise the code for D8.

Moderate’s picture

Thanks for your answer.
/imce doesn't use core jquery nor jquery_update, but front theme. So if you use jquery 1.9 in your front theme, you may have issues with imce, no?
The only solutions we found are to switch to admin theme for /imce or to create /admin/imce to use it.

ufku’s picture

What is front theme?

Moderate’s picture

The main theme used on the website. The opposite of admin theme.

ufku’s picture

If you're overriding the default jQuery with 1.9 then you'll also have issues with jQuery UI and possibly with many other modules.

Moderate’s picture

Is it a reason to not correct compatibilité in IMCE?
There are only 2 lines not compatible with jQuery 1.9 (those with $.browser). And I think many developers need jQuery 1.9 to use last functions in their websites, no?
But if you think it's not a prioritary issue, no problem... i will patch it like i can in my project. :)

ufku’s picture

Status: Active » Closed (won't fix)

I didn't say it was the reason.
The reason is stated in comment#1

If jquery update, which is the proper way to update jquery, supports 1.9 then we'll consider making the module compatible.

fb-multimedia’s picture

I upgrade my front theme with jquery 1.9.1 too.
for staying compatible with modules developped with jquery 1.4.4, I used the jquery migration plugin :
https://github.com/jquery/jquery-migrate/
It resolve the issues of imcompatibily with modules using the $browser function and maybe others.
So I put it in js folder of my omega subtheme and I declare it in my template.php :

function MONTHEME_preprocess_html(&$variables) {
    drupal_add_js(drupal_get_path('theme', 'fb_multimedia') . '/js/jquery-migrate-1.2.1.min.js', array(
    'scope' => 'header',
    'weight' => '15'
  ));
}

IMCE uses the front theme. it's charging the jquery 1.9.1 declare in template.php with MONTHEME_js_alter() but not the jquery-migrate in this MONTHEME_preprocess_html() (does somebody know why please?).

My solution for that is to use the admin_theme module and specify imce path to use admin theme.
Another solution is to modify in all>modules>IMCE>js>imce.js (ligne 792):
$.browser.msie && $('html').addClass('ie') && parseFloat($.browser.version) < 8 && $('html').addClass('ie-7');
par:
navigator.userAgent.match(/msie [7]/i)

nbathgate’s picture

Hi, i'm having this same problem, some features of IMCE file browser are not working because we need to run jQuery 1.10 for our theme.

Could you explain how you got IMCE file browser to display using the admin theme at admin/imce?

It seems that this problem is going to become more and more common as people more commonly implement themes using current versions of jQuery!

imclean’s picture

Version: 7.x-1.7 » 7.x-1.x-dev
Category: support » feature
Status: Closed (won't fix) » Active

@ufku,

If jquery update, which is the proper way to update jquery, supports 1.9 then we'll consider making the module compatible.

jQuery Update now updates Drupal 7 to jQuery 1.5.1/1.7.1/1.8.2, 1.9.1, 1.10.2 and jQuery UI 1.10.1 (in dev branch 7.x-2.x-dev)

helios.drupal’s picture

I am also facing the same issue regarding IMCE with jquery 1.9 or above.

I already have jquery migrate which added via _preprocess_html() (as suggested in above comment by fb_multimedia at #8), but jquery migrate js doesn't get included in IMCE page, and hence, the issue is still remaining.

So, I did a trick like below and get my IMCE working...

1. copy imce-page.tpl.php to my theme's template directory
2. in this copied imce-page.tpl.php file, inside head html element, after drupal_get_html_head() statement, I added jquery migrate js using drupal_add_js and with scope : header and last
3. clear theme registry
and got it worked....

Hope this way would help the others.....

ufku’s picture

Title: Compatibilité IMCE with jQuery 1.9 » Compatibility with jQuery 1.9
Issue summary: View changes
ufku’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

mmikitka’s picture

I just added the jQuery Migrate Plugin to jquery_update -- see https://drupal.org/comment/8341311#comment-8341311

All the best,
matt