使用javascript自动打开页面

rud*_*ph9 8 html javascript

基本上,我想要做的就是在通过java脚本加载当前页面后打开外部网页.

open my page -> javascript tells browser to open external page -> external page being loaded into the broser

我怎么能做到这一点?

mac*_*ack 20

你可以用这个

<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> 
Run Code Online (Sandbox Code Playgroud)