Return to the previous page and force the page to refresh

Source: Internet
Author: User

Use Window.history.go (-1) to return to the previous page at the same time to refresh the "up", this is suitable for "on the page" contains dynamic update content, such as calling the Forum's new posts, call the article system's latest article and so on. If your "Up page" does not have dynamically updated content, it is recommended not to do this, others point back to the time to load again. force load and refresh once

Add the following code to the page you want to load: View source print?

1 <script type= "Text/javascript" >
2 if (window.name!= "Bencalie") {
3 Location.reload ();
4 Window.name = "Bencalie";
5 }
6 else{
7 Window.name = "";
8 }
9 </script>
disable caching to achieve a refresh effect

Reference content: View source print?

1 <metahttp-equiv= "Expires" content= "0" >
2 <metahttp-equiv= "Cache-control" content= "No-cache" >
3 <metahttp-equiv= "Pragma" content= "No-cache" >

Back to the previous page code: View Source print?

1 <a href= "Javascript:window.history.go ( -1)" > Return to Previous page </a>

PHP will often use the following method, the server is processed to return to the previous page: View source print?

1 $page = "upload.php";
2 echo "<script>alert" (' Upload succeeded. '); Window.location = \ "". $page. " \ ";</script>"

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.