Home > Web Front-end > JS Tutorial > body text

Detailed example of refreshing the page in Javascript

黄舟
Release: 2017-09-23 10:22:50
Original
1410 people have browsed it

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 area


<meta http-equiv="refresh" content="20">
Copy after login

The 20 refers to refreshing the page every 20 seconds.

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


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

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!