Several methods for automatic refresh of HTML page

Source: Internet
Author: User

Usage scenarios:

1. The page needs to be refreshed periodically, loading the data in real time (WebSocket and SSE in H5 can be partially refreshed)

2. Jump to the specified page after a certain time (login registration, etc.)

3. Front-end development use pseudo-data to debug HTML pages (modify some JS variable values, you can automatically refresh the effect)

Example code:

1. Automatic page Refresh Note: 10 refers to the refresh of the page every 10 seconds.

1 <  http-equiv= "Refresh"  content= "Ten">


2. Jump to the specified page

1 <  http-equiv= "Refresh"  content= "10;url=http://www.51jfgou.com"  >


3. Page automatically refresh JS version

1 <  language= "JavaScript">2setTimeout (function () {location.reload ()},  +  // specify 1 seconds to refresh once 3</script>

Several ways to automate automatic refreshes of HTML pages

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.