搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

After refreshing my extension is not loading, whta i have to do to auto reload?

  • 6 回覆
  • 2 有這個問題
  • 1 次檢視
  • 最近回覆由 vishal2

more options

I have created a extension for Gmail. I added that to firefox and the extesion has aded but the problem is after refreshing or reopening i have reload extension also otherwise it won't work, what is the problem? i have attached 2 images that is one before reloading the extension and 2nd is after reloading the extension.

I have created a extension for Gmail. I added that to firefox and the extesion has aded but the problem is after refreshing or reopening i have reload extension also otherwise it won't work, what is the problem? i have attached 2 images that is one before reloading the extension and 2nd is after reloading the extension.
附加的畫面擷圖

所有回覆 (6)

more options

My complete guess is that you're not hooking into the page load correctly, or that you're looking for the load, but need to actually look for when the element is inserted into the DOM.

However, without knowing your code, it is very hard to know for sure.

If you can't figure it out, I suggest you hop over to our dedicated add-ons support https://discourse.mozilla.org/c/add-ons and discuss there. You might also want to share a couple of code snippets for what you're doing for the insertion routines.

more options

This is my code, i'm appending a button in gmail input box, button is appending but i have to reload extension each and every time. Please help me to solve this.

var btn = document.createElement("BUTTON");
btn.setAttribute("id","button");

btn.innerHTML = "BUTTON"; btn.setAttribute("style","background-color:rgb(65, 192, 4);font-size:1.0em;width:95px;height:35px;border-color:rgb(65, 192, 4);color:white;border-radius: 5px;grid-row:1.7em;margin-left:5px"); //document.body.appendChild(btn); document.getElementById(':me').appendChild(btn);

more options

As I mentioned before, it depends on how you're triggering that code to be called, not necessarily the code itself. You need to make sure it is triggered on page/document load, as well as when you load the add-on.

The community on discourse is in a much better position to help you here.

more options

how to trigger that code when page is refreshed? can you please help me with that

more options

Sorry, I don't know enough about those parts of the WebExtensions to help you with that. I'm guessing based on what you've reported.

Please ask the community at https://discourse.mozilla.org/c/add-ons. You might also be able to get help from them on IRC in the #webextensions channel.