Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is is possible to call a function after window.location has loaded new URL?

I'd like to be able to call a jquery function once window.location has completed loading a URL. Is this possible? I can't seem to find anything online about this.

for instance:

if(parseInt(msg.status)==1) {
    window.location=msg.txt;
    alert("This URL has finished loading")
}

Thanks, -Paul

like image 841
Paul Avatar asked Sep 21 '11 02:09

Paul


1 Answers

You can either use window.onload of the destination page (if you have access to modify the code of that page), or you can use window.onunload to have the alert be launched when unloading the current page. You cannot execute code on the current page after the new page has been loaded.

like image 69
Jon Newmuis Avatar answered Oct 05 '22 11:10

Jon Newmuis