>Форум Mozilla Россия http://forum.mozilla-russia.org/index.php >Разработка http://forum.mozilla-russia.org/viewforum.php?id=18 >Загрузка алерта при заходе на страницу http://forum.mozilla-russia.org/viewtopic.php?id=70384 |
tramway > 12-08-2016 14:18:50 |
Привет. Выделить код Код: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) { var 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); |