How to refresh Web pages using JavaScript _ Basics

Source: Internet
Author: User
Tags time interval

You can use the JavaScript Location.reload method to refresh a Web page. When the user clicks on a link this code can be invoked automatically in an event.

If you want to use the mouse to click to refresh the page, you can use the following code:

<a href= "Javascript:location.reload (True)" >refresh page</a>

To get a better idea of it, you can refresh the page
Automatic refresh:

You can also refresh the page by automatically using JavaScript for a given time period. The following is an example of refreshing this page every 5 seconds. Can change this time according to your request.

 

The settimeout () here is a built-in JavaScript function that can be used to execute another function after a given time interval.

Related Article

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.