HomeLinuxAuto Refresh Code in HTML Utilizing Meta Tags

Auto Refresh Code in HTML Utilizing Meta Tags


Auto-refreshing code means executing a service routinely after a specified time period. When the time outlined for auto refresh reaches, it triggers the auto-refresh operation and the code routinely refreshes each time the outlined time reaches. A meta tag can be utilized in HTML to refresh the code in line with the outlined time interval.

How one can Auto Refresh Code Utilizing Meta Tags?

To make an auto-refresh utilizing HTML, the meta tag is used with the “http-equiv” property set to “refresh” after which the “content material” attribute is used to outline the interval of every refresh. To higher perceive this meta tag, check out the syntax under:

Syntax

The syntax to create a meta tag to refresh an HTML code or doc is as follows:

<meta http-equiv=“refresh” content material=” “ />

The “http-equiv=refresh” performs the refresh operation and content material on this defines the time restrict after which the net web page routinely refreshes. Whereas refreshing, the content material of the net web page doesn’t disappear however the tab on which the net web page shows retains on refreshing many times routinely:

<title>Auto Refresh</title>

<meta http-equiv=“refresh” content material=“5” />

<h2>This may refresh the web page after each 5 seconds</h2>

Within the above code, we created an HTML meta tag with http-equiv=refresh attribute that provides details about the operation to be carried out via this meta tag i.e. refresh, after which added content material= attribute and outlined its worth as 5. Which means that the net web page that it’s going to create will routinely refresh after 5 minutes and it’ll proceed refreshing after each 5 minutes.

The output created via the above meta tag will carry on refreshing each 5 seconds and might be displayed as:

Be aware: If we alter the worth of the content material, as an illustration, if we alter it to fifteen, this can set off the refresh after each 15 seconds and the net web page will refresh after each 15 seconds.

That is how we will auto-refresh an HTML code utilizing Meta tags.

Conclusion

Utilizing Meta tags to auto-refresh an HTML code may be very easy. It simply requires the http-equiv=refresh attribute to outline the refresh operation and the content material attribute to outline the time interval in seconds after which the refresh must be triggered contained in the meta tag. The net web page routinely retains on refreshing after each interval of the outlined worth.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments