Open a page with window open function and change URL - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window open

Description

Open a page with window open function and change URL

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from w ww . jav a 2  s .c  om*/
function doSomething() {
    window.open("http://www.google.com");
    window.location.replace("http://java2s.com");
 return false;
}
    }

      </script> 
   </head> 
   <body> 
      <a href="#" onclick="doSomething();">Test</a>  
   </body>
</html>

Related Tutorials