我有一個使用coda-slider在照片之間移動的Firefox擴展。 Coda-slider需要jQuery可用。有沒有辦法在頁面加載後將jQuery包含在頁面的DOM中,以便在插入頁面後加載它?在Firefox擴展中使用jQuery擴展
2
A
回答
4
假設你的分機可以使用JavaScript:
這個片斷var s=document.createElement('script');
s.setAttribute('src','https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');
// or whatever other url you want to get jQuery from.
document.getElementsByTagName('body')[0].appendChild(s);
來源:Learning jQuery。
0
您可以使用Firefox的jQuerify
插件。它也可用於鉻也但不確定
+0
我讀到這個問題的方式表明OP希望從他正在寫的擴展中包含jQuery; jQuerify可以通過編程方式調用嗎? – 2010-11-15 06:26:28
2
使用下標加載程序組件效果很好。唯一的缺點是你必須包含jQuery作爲本地資源(無論是在Chrome中還是作爲模塊)。例如:
var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://myext/content/jquery-1.5.2.min.js");
相關問題
- 1. jQuery在Firefox擴展
- 2. 在Firefox擴展中使用jQuery
- 3. Firefox擴展jquery 1.3+
- 4. 擴展現有的Firefox擴展/在自己的擴展中使用現有Firefox擴展的功能
- 5. 在Firefox擴展
- 6. 在Firefox擴展
- 7. Firefox擴展中的jQuery
- 8. Autorun Firefox擴展
- 9. jquery和qtip的firefox擴展
- 10. 添加jQuery的Firefox擴展
- 11. 使用Firefox擴展JavaScript從
- 12. 使用Firefox擴展存儲
- 13. Firefox擴展,使用browser.contentDocument
- 14. Firefox擴展訪問DOM(使用jQuery)
- 15. jQuery:如何擴展擴展?
- 16. 在Firefox擴展中使用indexedDB
- 17. 如何在Firefox擴展中使用Prototype?
- 18. 在Firefox擴展中使用Components.utils.import
- 19. 在Firefox擴展中使用Google Analytics
- 20. 在Firefox擴展中使用NPRuntime插件
- 21. 在Firefox擴展中使用Extjs
- 22. 在Firefox擴展中使用processing.js
- 23. 在firefox xul擴展中使用requirejs
- 24. Firefox擴展插件?
- 25. 登錄Firefox擴展
- 26. Firefox擴展和nsIMutationObserver
- 27. PyExc_ValueError和Firefox擴展
- 28. 修改Firefox擴展
- 29. 調試Firefox擴展
- 30. firefox擴展開發
你問[同樣的問題昨天(http://stackoverflow.com/questions/4137353/jquery-in-firefox-extension)。你有兩個答案。他們沒有工作嗎?如果不是,爲什麼不呢?請不要兩次提問,而是要對提供的答案發表評論。 – 2010-11-11 15:46:21