Invoking the location.replace() Method
<html> <head> <title>location.replace() Method</title> <script type="text/javascript"> function doReplace() { location.replace("http://www.java2s.com"); } </script> </head> <body> <form name="myForm"> <input type="button" value="Replace Me" onclick="doReplace()" /> </form> </body> </html>