I want to run javascript after someone clicks on a hyperlink in A.aspx and after loading B.aspx, but I do not want to manually add this javascript to B.aspx
You cannot do this, no. (Not without everyone having the browser extension installed.) I’m afraid it’s unpleasant if the offline pages do not already have the script that they load so that you can add this new code, you will have to change each of the offline pages to include a new script.
I checked just now - hyperlinks look like this <a href="javascript:void(0);" onclick="OpenPopUpPage('B.aspx?ItemID=65','',500,350);">test link</a>, they seem to useOpenPopUpPage
. OpenPopUpPage window.open, A.aspx , B.aspx , , A.aspx B.aspx ( , , ).
OpenPopUpPage window.open, (DOMContentLoaded , , load)), :
var url = "B.aspx";
var wnd = window.open(url);
checkChildReady();
function checkChildReady() {
if (wnd.document && String(wnd.document.location).indexOf(url) != -1) {
if (wnd.document.readyState != "loading") {
windowReady();
} else {
wnd.document.addEventListener("DOMContentLoaded", childReady, false);
}
}
}
function childReady() {
}