Different jquery Libaries = Hard to track down

This MOD is called “YouTube banner modal”
https://anymod.com/mod/youtube-banner-modal-lllamb

It USES this JQUERY SLIM VERSION
https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js

The external script asset can completely destroy a lot of JQuery-functions, IF another (full) Jquery Version is already loaded on the same page.

THUS: I suggest anyMod might print a warning to the console, IF TWO or more Jquery-Libaries are found loaded on the same page.

This error is hard to track down.

The error can be especially confusing and unexpected.

The warning-message printed to the console would be most helpful if if stated the whereabouts of all Jquery Libaries at play.

The warning message may let the admin know which MODs are loading a second jquery asset .

Thank you for the suggestion! We are looking at ways to avoid this problem altogether, but in the meantime we will add a console warning to our roadmap :+1:

The jquery libary is loaded twice on this page :
https://novaconsonanza.de/orchestermitglieder.min.html
the versions are
1: Head Section
/! jQuery v1.12.4 | © jQuery Foundation | jquery.org/license /
2: and FROM alnkmd

/*! jQuery v3.3.1 | © JS Foundation and other contributors | jquery.org/license */

A warning-message printed to the console would be most helpful.

Does this only happe due to the entirely different versions of the two Jquery - Libaries?

see screenshot:

Yes, this is usually because 2 mods are using 2 different versions of jQuery. You can replace the version in one of the mods and usually everything will work well. We recommend using the newer version whenever possible, but every now and then the 3rd party libraries used in mods require an older version.

Okay, Understood, great.

I will act accordingly. Thank you!

To ease the identification of such an error , A Warning printed to the Console might be helpful.

As far as I am concerned, I am now aware enough to identify such an issue quickly enough, even without a hint in the console

1 Like

this was an issue today again . jquerySlim.js was injected by a MOD , and that caused an issue due to another fulljQuery.js-Libary loaded in the head of the page. Those issues are hard to track down. The console gave NO WARNING about two JS Libaries potentially causing issues

Hi Stefan, thanks for following up. We haven’t found a good solution for this that is generalizable to multiple versions of different libraries. We’ll continue to think about how we might accomplish it, and if you have any ideas please let us know.

Hi Tyler, I hope you are well.

I highly respect the fact you are asking for feedback, I really do:

I felt it might be an option to take some kind of a “fuzzy approach” eventually:

This is my idea:

IF the html-page is requesting any JS-File in the head-section containing the string * jquery * inside of its js.filename, then anymod might print a warning message to the console, saying there MIGHT perhaps be an issue with more than one jQuery-Libary beeing loaded. And that printed onsole message might also additionally add a recommendation to check on that issue.

I did not think about the above approach in detail . There may be situations where the above approach might not be helpful.

Thanks for your reply again , and have a fabulous weekend ; ) Stefan

My job-life might soon change: I will probably leave the freelancing-world behind and engage in a permanent fulltime position as a Junior Webdeveloper with an agency here in Hamburg, it is not yet decided where the winds will exactly carry me yet though :wink:

1 Like