Home  >  Article  >  Web Front-end  >  Detailed example of refreshing the page in Javascript

Detailed example of refreshing the page in Javascript

黄舟
黄舟Original
2017-09-23 10:22:501368browse

This article mainly introduces relevant information about the examples of Javascript refreshing the page. I hope this article can help everyone. Friends in need can refer to the following

Instances of Javascript refreshing the page

Several ways to refresh the page using Javascript:

1 history.go(0)
2 location.reload()
3 location= location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL =location.href

Methods to automatically refresh the page:

1. Automatically refresh the page: Add the following code to the 93f0f5c25f18dab9d176bd4f6de5d30e area


<meta http-equiv="refresh" content="20">

The 20 refers to refreshing the page every 20 seconds.

2. The page automatically jumps: add the following code to the 93f0f5c25f18dab9d176bd4f6de5d30e area


<meta http-equiv="refresh" content="20;url=http://www.wyxg.com">

The 20th finger will jump to the http://www.wyxg.com page after 20 seconds.

3. The page refreshes automatically js version


<mce:script language="JavaScript"><!-- 
function myrefresh()  
{  
    window.location.reload();  
}  
setTimeout(&#39;myrefresh()&#39;,1000); //指定1秒刷新一次  
// --></mce:script>

The above is the detailed content of Detailed example of refreshing the page in Javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Date object in JavaScriptNext article:Date object in JavaScript