I'm creating a jquery plugin and I want to verify an external script is loaded. This is for an internal web app and I can keep the script name/location consistent(mysscript.js). This is also an ajaxy plugin that can be called on many times on the page.
如果我可以验证脚本是否未加载,我将使用以下方法加载它:
jQuery.getScript()
How can I verify the script is loaded because I don't want the same script loaded on the page more than once? Is this something that I shouldn't need to worry about due to caching of the script?
更新: 在我们的组织中,我可能无法控制谁使用此插件,也可能无法强制该脚本不在页面上,无论是否具有特定ID,但脚本名称将始终位于相同的位置,具有相同的名称.我希望我可以使用脚本的名称来验证它是否已实际加载.