views:

109

answers:

2

Is it possible to load a Javascript program from an html page and then make the Javascript load another html page instead of the page the loaded the program?

+1  A: 

Yes. In the javascript code:

window.location.href = "http://new.website.com/that/you/want_to_go_to.html";
chpwn
but be aware, that this script isn't included/executed on the new page! otherwise you will get a recursive call
Andreas Niedermair
+1  A: 

You can include a .js file which has the script to set the

window.location.href = url;

Where url would be the url you wish to load.

Ravia