Window.history.go () Return to the previous page and refresh the "Up" code

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 dynamic update content, suggest not to do this, others point to return time to load again ...


1. Force load and Refresh once
Add the following code to the page you want to load: <script>
if (window.name!= "Bencalie") {
Location.reload ();
Window.name = "Bencalie";
}
else{
Window.name = "";
}
</script>



2. Prohibit caching, to achieve the refresh effect. Content reference to: <meta http-equiv= "Expires" content= "0" >
<meta http-equiv= "Cache-control" content= "No-cache" >
<meta http-equiv= "Pragma" content= "No-cache" >



Back to previous code: <a href= "Javascript:window.history.go ( -1)" > Return to previous page </a>--------------------------------------- ------------------------------------------Backup as soon as you enter the page scroll to the bottom effect: <body onload= "Window.scrollto (0, Document.body.scrollHeight) ">

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.