I am developing Mozilla Extension (Legacy extensions) by using XUL. In this
window
.addEventListener(
"load",
function(event) {
(function(loader) {
loader
.loadSubScript("chrome://cashbackurl/content/jquery-1.11.3.min.js");
})
(Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader));
// Your code goes
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) {
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);
if (win.top == win.self) {
cburl.getDataLoder();
}
}
}
Here I am using "doc" element to get referrer of current url. I tried by using doc.referrer but I am not getting correct referrer. Any once suggest me how to resolve this issue.
Thank you.