HTML Meta Refresh refresh and jump (redirect) page

Source: Internet
Author: User

Refresh property Value--refreshes and jumps (redirects) page

Refresh with jump (redirect) page

Refresh appears in the Http-equiv property, using the content attribute to indicate the start time of the refresh or jump and the URL of the jump


Refresh Example

Refresh this page after 5 seconds:

<metahttp-equiv= "Refresh" content= "5"/>

5 Seconds to go to dream Capital home:

<metahttp-equiv= "Refresh" content= "5; url=http://www.111cn.net/"/>

Of course, in addition to these methods and JS can also jump and refresh, since the following about this refresh page we will look again JS add it

JavaScript refreshes the page in several ways:

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

JS Page Jump

1.window.location.href Way
<script language= "javascript" type= "Text/javascript" >
Window.location.href= "Target.aspx";
</script>

2.window.navigate Way Jump
<script language= "JavaScript" >
Window.navigate ("target.aspx");
</script>

3.window.loction.replace way to achieve page jump, pay attention to the difference with the first way
<script language= "JavaScript" >
Window.location.replace ("target.aspx");
</script>
There are 3 JSP pages (1.aspx, 2.aspx, 3.aspx), into the system default is 1.aspx, when I enter 2.aspx, 2.aspx inside with Window.location.replace ("3.aspx");

With Window.location.href ("3.aspx");

There is no difference from the user interface, but when the 3.aspx page has a "back" button, call Window.history.go (-1); Wondow.history.back () method, the point of this return button to return to the 2.aspx page, the difference is out, when using Window.location.replace ("3.aspx"); Connect to the 3.aspx page, the 3.aspx page calls Window.history.go ( -1), Wondow.history.back (), the method is not good, will return to 1.aspx.

4.self.location way to achieve page jump, and the following top.location a small difference
<script language= "JavaScript" >
self.location= ' target.aspx ';
</script>

5.top.location
<script language= "JavaScript" >
top.location= ' target.aspx ';
</script>

6. Do not recommend this way to jump
<script language= "JavaScript" >
Alert ("return");
Window.history.back (-1);
</script>

 meta to implement the jump (content = 3 units is seconds)
<meta Http-equiv=refresh content=3; Url= "Http://www.111cn.net"

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.