Web development often encounter page jump or delay jump demand, master a variety of page jump way is very necessary.
The following is my summary of useful html/js/php three types of methods to achieve the jump, examples are three seconds after the jump to the index.php page.
1,html Method:
Add <meta> tag to head
<meta http-equiv= "Refresh" content= "3;url= ' index.php '" >
2,js Control Jump Method
A.location Direct plus Link way
<script type= "Text/javascript" >
settimeout ("window.location=" (' index.php ', 3000);
</script>
B.location.href Way
<script type= "Text/javascript" >
settimeout ("window.location.href= ' index.php '", 3000);
</script>
C.location.assign Way
<script type= "Text/javascript" >
settimeout ("window.location.assign (' index.php ')", 3000);
</script>
D.location.replace Mode (note that the page is "replaced" and will not be queried in the browser's history)
<script type= "Text/javascript" >
Widdow.location.replace (' index.php ');
</script>
E.js History Go (n) Way ( n Indicates the number of forward steps relative to the current page for the history record,n is a negative number to return to the previous page)
<script type= "Text/javascript" >
window.history.go (n);
</script>
F.js History go (URL) Way (note that the URL must be in the history, otherwise the page will not jump)
<script type= "Text/javascript" >
window.history.go (' index.php ');
</script>
G.js window.open Way, by opening a new window, to achieve the jump. (The second property is the optional target option, the value can be frame Id/_blank , and the third option is the specific setting options for the new pop-up window, including height/width , etc.)
<script type= "Text/javascript" >
settimeout ("window.open (' index.php ', Target,args)", 3000);
</script>
3,php script control Jump Way, by overwriting HTTP header information to jump
A.header Refresh mode:
Header ("Refresh:3;url= ' index.php '");
B. Header location mode:
Sleep (3);
Header ("location:index.php");
Note that this can cause the current page to be inaccessible. Where currently register.php page is linked to login.php page,login.php page Header location mode jump, the page will be directly from the register.php page wait three seconds to jump to index.php, will not enter the login.php the page because header location redirects the page.
If there is a mistake, please correct me, thank you.
The above article uses the html/js/php way to realize the page delay to jump the simple example is the small series to share to everybody's content, hoped can give everybody a reference, also hoped that everybody supports the cloud habitat community.