简体   繁体   English

Firefox缓存我的扩展程序。 如何避免呢?

[英]Firefox caching my extension. How to avoid it?

I simply want to include jQuery and then my custom JS file to call ready() event. 我只想包含jQuery,然后包含我的自定义JS文件来调用ready()事件。 For testing I put an alert on my .js file, it worked fine. 为了进行测试,我在.js文件中添加了一个警报,它工作正常。 Now when I change content of my js file it keeps giving same old alert. 现在,当我更改js文件的内容时,它会一直发出相同的旧警报。 In console now it shows: 现在在控制台中显示:

Could not read chrome manifest 'file:///C:/Program%20Files/Mozilla%20Firefox/extensions/%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D/chrome.manifest'. 无法读取Chrome清单'file:/// C:/Program%20Files/Mozilla%20Firefox/extensions/%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D/chrome.manifest'。

Why is it so hard to call JS files, specially jquery functions? 为什么调用JS文件(尤其是jquery函数)如此困难?

My files content given below: 我的文件内容如下:

chrome.manifest chrome.manifest

content myext content/
overlay chrome://browser/content/browser.xul chrome://myext /content/myext.xul

myext.xul myext.xul

<?xml version="1.0"?>
<overlay id="Scrapper-Overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://fbpicker/content/functions.js" />
</overlay>

functions.js functions.js

Initially I put alert('test'); 最初,我将alert('test'); it popped up. 它弹出了。 Later I put: 后来我放:

window.addEventListener('load', function () {
    gBrowser.addEventListener('DOMContentLoaded', function () 
    {
        alert("addd");
    }, false);
}, false);

But it is keep showing test as popup. 但是它一直将测试显示为弹出窗口。

Why FF is caching the content and how to remove it? 为什么FF缓存内容以及如何删除内容?

On Console I am getting following warnings: 在控制台上,我收到以下警告:

Timestamp: 8/6/2013 2:15:32 PM
Warning: XUL box for _moz_generated_content_before element contained an inline #text child, forcing all its children to be wrapped in a block.
Source File: chrome://global/content/bindings/toolbar.xml
Line: 382

Timestamp: 8/6/2013 2:15:32 PM
Warning: XUL box for _moz_generated_content_before element contained an inline #text child, forcing all its children to be wrapped in a block.
Source File: chrome://global/content/bindings/browser.xml
Line: 0

Timestamp: 8/6/2013 2:15:34 PM
Warning: Key event not available on some keyboard layouts: key="b" modifiers="accel,alt"
Source File: chrome://browser/content/browser.xul
Line: 0


Timestamp: 8/6/2013 2:15:30 PM
Warning: Unknown property 'order'.  Declaration dropped.
Source File: resource://gre-resources/ua.css
Line: 46

See the "Setting up an extension development environment" article on MDN, in particular the bits about nglayout.debug.disable_xul_cache . 请参阅有关MDN的“设置扩展开发环境”文章,尤其是有关nglayout.debug.disable_xul_cache的位。 Also, the Firefox extension proxy file is very useful. 另外, Firefox extension proxy file非常有用。

While the page talks about Firefox a lot, most of the content also applies to other mozilla-powered apps, such as Thunderbird, Seamonkey or InstantBird. 尽管该页面大量讨论了Firefox,但大多数内容还适用于其他基于Mozilla的应用程序,例如Thunderbird,Seamonkey或InstantBird。

JFYI: Using jquery in extensions, in particular XUL overlay based ones, while somewhat discouraged, is OK, as long as you preferably load it as a subscript , or at least .noConflict() it. JFYI:在扩展名中使用jquery,特别是基于XUL覆盖的扩展名,虽然有些气disc,但可以,只要您最好将其作为下标或至少.noConflict() This is because overlays share the same scope/namespace. 这是因为覆盖共享相同的范围/名称空间。 See JavaScript Object Management from the XUL School tutorial for more information. 有关更多信息,请参见XUL School教程中的JavaScript Object Management

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 firefox扩展。 如何捕获onload事件? - firefox extension. How to catch onload event? Firefox扩展。 如何从控制台访问“浏览器”名称空间? - Firefox extension. How to access “browser” namespace from console? FireFox扩展。 如何将叠加层添加到窗口的内容区域 - FireFox extension. How i can add overlay into content area of window 火狐网络扩展。 访问内容脚本中的弹出内容 - Firefox Web extension. Accessing popup content in content script Chrome,Firefox,IE扩展程序。 我需要哪种语言? - Chrome,Firefox,IE extension. Which language i need? Firefox扩展。 DOMContentLoaded在某些页面上触发多次 - Firefox extension. DOMContentLoaded fires more than once on some pages Firefox 扩展如何最好地避免污染全局命名空间? - How best for a Firefox extension to avoid polluting the global namespace? 如何在我的firefox扩展中运行本地exe? - How to run a local exe in my firefox extension? 如何动态 append 浏览器扩展中的内容脚本。? - How to dynamically append the content script in browser extension.? ff扩展名。 如何在菜单的oncommand属性中将参数传递给函数 - ff extension. how to pass parameters to a function in the oncommand attribute in menu
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM