3

Some of the visitors of my site load a lot of scripts, not linked by my website. This is probably due to the software Superfish WindowShopper. This library seems to load jQuery as well, so my page has for some visitors multiple versions of jQuery loaded.

This results in the exception: Object [object Object] has no method 'dialog'

How to prevent Superfish (or other adwares) stealing my .dialog of jQuery UI?

Some unintentionally linked scripts:

https://appnext-a.akamaihd.net/source-ds.js
//www.superfish.com/ws/sf_main.jsp?dlsource=pcom&userId=4709955453116160291&CTID=p0

etc etc. Scripts vary per browser. The first one from Akamaihd.com is a modified jQuery. Maybe there are more. Multiple jQueries make the .dialog dissapear (Uncaught TypeError: Object [object Object] has no method 'dialog').

Fiddle: http://jsfiddle.net/fybJ3/ Problem appears in Chrome and Firefox. IE has no problems showing the dialog.

My current workaround: Show an old fashioned 'alert' when this exception occurs.

What should I do?

  • Can jQuery UI be fixed so the dialog can be shown when multiple versions of jQuery are loaded?
  • Should I choose a different library for dialogs?
  • Or ???
Community
  • 1
  • 1
  • It would probably be for the best if you could remove unrelated script entries from that list. – Etheryte Jun 04 '14 at 19:34
  • Thanks for the quick reply. Unloading scripts at visitor side is not possible, according to this: http://stackoverflow.com/questions/4365062/how-to-unload-a-javascript-from-an-html And I don't know what to unload, since the included scripts differ. – user3708485 Jun 04 '14 at 19:47
  • Not from the site, from your question here. Many of the scripts included aren't related to the question. – Etheryte Jun 04 '14 at 19:49
  • Question updated and Fiddle added. – user3708485 Jun 05 '14 at 19:02

1 Answers1

0

Your best bet is to insulate your known instance of jQuery using noConflict().

What is happening is a new version will overwrite the first version and any plugins that are bound to the first version are therefore wiped out.

See noConflict() API docs

charlietfl
  • 170,828
  • 13
  • 121
  • 150
  • Thanks. This is the key. I don't have the problem solved yet, because I need to investigate the following difficulties: – user3708485 Jun 08 '14 at 08:06
  • 1. Evey script needs to include the noConflict. 2. Behavior is different when 'adware' libray is included before vs after my scripts. – user3708485 Jun 08 '14 at 08:07