Надо создать обработчик загружаемой старницы, чтобы стоял на ней таймер, или Listener, и через какоето время запускал функцию с доступом к телу страницы

Использую такой пример для обработки страницы

Выделить код

Код:

var myExtension = {
    init: function() {
        // The event can be DOMContentLoaded, pageshow, pagehide, load or unload.
        if(gBrowser) gBrowser.addEventListener("DOMContentLoaded", this.onPageLoad, false);
    },
    onPageLoad: function(aEvent) {
        const doc = aEvent.originalTarget; // doc is document that triggered the event
        var win = doc.defaultView; // win is the window for the doc
        // test desired conditions and do something
        // if (doc.nodeName == "#document") return; // only documents
        // if (win != win.top) return; //only top window.
        // if (win.frameElement) return; // skip iframes/frames
        

alert("page is loaded \n" +doc.location.href);
        
}
}
window.addEventListener("load", function load(event){
    window.removeEventListener("load", load, false); //remove listener, no longer needed
    myExtension.init();  
},false);

попробовал поставить такой таймер


Выделить код

Код:

var myExtension = {
    init: function() {
        // The event can be DOMContentLoaded, pageshow, pagehide, load or unload.
        if(gBrowser) gBrowser.addEventListener("DOMContentLoaded", this.onPageLoad, false);
    },
    onPageLoad: function(aEvent) {
        const doc = aEvent.originalTarget; // doc is document that triggered the event
        var win = doc.defaultView; // win is the window for the doc
        // test desired conditions and do something
        // if (doc.nodeName == "#document") return; // only documents
        // if (win != win.top) return; //only top window.
        // if (win.frameElement) return; // skip iframes/frames
        
function TimeE(doc)
{
alert("page is loaded \n" +doc.location.href);
[b]setTimeout('TimeE(doc);', 7000);[/b]
}


TimeE(doc);    



    
        
}
}
window.addEventListener("load", function load(event){
    window.removeEventListener("load", load, false); //remove listener, no longer needed
    myExtension.init();  
},false);

При таком примере, таймер не может получить из функции, доступ к doc,

Выделить код

Код:

setTimeout(function() {
    TimeE(doc);
}, 7000);
Infocatcher пишет
Выделить код

Код:

setTimeout(function() {
    TimeE(doc);
}, 7000);

благодарю! сработало = )