Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE aborting plugin script causes JQuery problems on site

I am working on a https website and a plugin totally unrelated to my site (requesting http elements) was causing security problems.

I have disabled (Windows) Internet Options -> Security -> Mixed Mode (so that we cannot fetch http resources from a https site).

With this restriction in place IE9 will abort a script run by the plugin requesting http elements whenever I'm on a https site (in this case the offending plugin is http://www.freemake.com/ video downloader). Console output: SEC7111: HTTPS security is compromised by http://download.freemake.com/images/arrow.png -link to my https site- SCRIPT16388: Operation aborted This abort happens after/end-of $(document).ready(...).

What happens next however is causing me some headaches... SCRIPT438: Object doesn't support property or method 'cookie' This is refering to the $.cookie function (it also happens with many other jQuery functions).

Various functions of jQuery are seemingly disabled or removed. I run some console logs before the above abort operation: LOG: jQuery.cookie >>> true LOG: $.cookie >>> true LOG: jQuery >>> true LOG: $ >>> true

As you can see they exist. After the abort operation I call the logs again:

LOG: jQuery.cookie >>> false LOG: $.cookie >>> false LOG: jQuery >>> true LOG: $ >>> true

How could the abort operation of the plugin script affect my site? The site is hosting it's own jQuery lib.

like image 745
Wollan Avatar asked Apr 17 '26 21:04

Wollan


1 Answers

It's likely they are sharing the same global variable "$" to remove it from global scope use

jQuery.noConflict();

then assign it to new variable like this

$j = jQuery;

like image 68
VoronoiPotato Avatar answered Apr 20 '26 13:04

VoronoiPotato



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!