Using html/js/php method to implement page delay jump

Source: Internet
Author: User

Web development often encounter page jump or delay jump demand, master a variety of page jump method is very necessary.

Here is my summary of useful html/js/php three ways to implement the Jump method, examples are three seconds after the jump to the index.php page.

1,html Method:

Add <meta> tags to HEAD

<http-equiv=content="3;url= ' index.php '" >  

2,js Control Jump Method

A.location Direct Add Link method

<type="Text/javascript" >  setTimeout ("window.location= (' index.php '");  </script>      

B.location.href Way

<type="Text/javascript" >  setTimeout ("window.location.href= ' index.php '", 3000); </script>      

C.location.assign Way

<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)

<type="Text/javascript" >  Widdow.location.replace (' index.php ');  </script>    

E.js history Go (n) mode (n indicates the number of steps forward for the history relative to the current page, and n is a negative representation to return to the previous page)

<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)

<type="Text/javascript" >  window.history.go (' index.php ');  </script>    

G.js window.open Way to achieve jump by opening a new window. (Its second property is an optional target option, the value can be frame id/_blank, etc., the third option is the specific setting options for the new popup, including Height/width, etc.)

<type="Text/javascript" >  setTimeout ("window.open (' index.php ', Target,args)",  3000); </script>      

3, PHP script control jump mode, by overwriting the 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 will cause the current page to not be entered. Even if currently in the Register.php page link to login.php page, login.php page with header location to jump, the page will be directly from the register.php page three seconds to jump to index.php, will not enter the L ogin.php page, this is because the header location redirects the page.

If there is any mistake, please correct me, thank you.

Using html/js/php method to implement page delay jump

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.