After refreshing my extension is not loading, whta i have to do to auto reload?
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.
Alle antwurden (6)
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.
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);
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.
how to trigger that code when page is refreshed? can you please help me with that
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.
Thank you.