[英]How to prevent jQuery overlading on my site (e.g. by a browser addon)
I am using jQuery on my website and Honeybadger to get notified about javascript exceptions. 我在我的网站和Honeybadger上使用jQuery,以获取有关javascript异常的通知。 The tool shows me many errors that occurr because the global
jQuery
and $
variables are overwritten by another jQuery-Version (eg from https://ajax.googleapis.com/.. .) 该工具向我显示了许多错误,因为全局
jQuery
和$
变量被另一个jQuery版本覆盖(例如,来自https://ajax.googleapis.com /..。 )
So I am thinking about using jQuery.noConflict
to use another variable for jQuery (eg $j
). 所以我在考虑使用
jQuery.noConflict
为jQuery使用另一个变量(例如$j
)。 Since I use a few addons for jQuery, this must happen right after all of them are loaded, right? 由于我为jQuery使用了一些插件,这必须在所有这些插件加载后发生,对吧?
But does it work all the time or might another jQuery be injected before all my addons are loaded? 但它是否一直有效,或者可能在我的所有插件加载之前注入另一个jQuery?
只要所有插件都知道使用$ j,加载其他jquery时无关紧要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.