Is there a way to fire a javascript function after everything on the page has loaded, after the back button has been used?
Basically I have search results which I store with localStorage which works great but I can't get the function to fire after everything else has loaded. It does fire but get overwritten by another function so want to wait until everything has finished.
I've tried:
window.onload
document.onload
if(window.attachEvent) {
window.attachEvent('onload', yourFunctionName);
} else {
if(window.onload) {
var curronload = window.onload;
var newonload = function() {
curronload();
yourFunctionName();
};
window.onload = newonload;
} else {
window.onload = yourFunctionName;
}
}
document.onreadystatechange = function () {
if (document.readyState == "complete") {
myFunction();
}
}
Is there an absolute way after hitting the back button, knowing when the page has absolutely finished loading?
I'm using javascript, not jQuery