There are many ways to change the location of browsers; The most common is window.location.href = "URL"; Modifying other properties of location can also change the currently loaded page: Location.hash location.search location.pathname Location.port is set to the new value to change the URL; The browser will generate a record , you can use Location.replace () to disable this behavior by clicking the Back button to navigate to the previous page; This method takes only one argument, the URL to navigate to, and the new record is not generated in the history, that is, the previous page is not returned; Reload () A parameter that is not accepted is a page reload, and the accepted argument is true false; The default is false, which is that the page loads true from the cache and is reloaded from the server;
<body> <button id= "btn" > Jump URL </button> </body> <script> var btn = document.getElementById ("btn"); Btn.onclick = function () {window.location.replace ("tanchu.html"); } </script>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.