Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Essentially, all I want to do is open an external web page after the current page is loaded via java script.
open my page -> javascript tells browser to open external page -> external page being loaded into the broser
How may I accomplish this?
you may use this
<html> <head> <script type="text/javascript"> function load() { window.location.href = "http://externalpage.com"; } </script> </head> <body onload="load()"> <h1>Hello World!</h1> </body> </html>
Add a comment
Hope it should be window.location. Check the code.
Technically you can:
location.href = "http://example.net/";
… but you should perform an HTTP redirect instead as that is more reliable, faster and better food for search engines.
You can also use the "open" method to open the source file or url on a new window.
window.open("anyfile.*");
or
window.open("http://anylocation.com");
Hi please try this code for page loading time we will redirect whatever u configured the urls.
<!DOCTYPE html> <html> <head> <script> function myFunction() { window.open('https://google.com'); } </script> </head> <body onload="myFunction()"> </body> </html>
<body> <script> document.body.innerHTML += '<a href="https://www.google.com/" style="display: none;" id="link">Link</a>'; document.getElementById("link").click(); </script> <body>
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.