Why does jQuery load twice in my GreaseMonkey Script

两盒软妹~` 提交于 2019-11-30 21:27:42

This is probably because the target page is loading frames or iframes.

Add these lines to the top of the code-portion of your script:

if (window.top != window.self)  //-- Don't run on frames or iframes
    return;


Also, if you are just using FF + GM, don't bother with all that rigamarole to load jQuery. GM now works with the later jQuery versions.

Just add a line like:

// @require http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js

into your script's metadata block. jQuery will be copied once onto your local machine and run from there -- eliminating what can sometimes be a few seconds delay in your script's runtime.

And such scripts can run in Chrome, if you use one of the GM-emulating extensions like TamperMonkey.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!