开发者

How to refresh a HTML iframe in asynchronous time intervals?

开发者 https://www.devze.com 2023-01-03 14:24 出处:网络
I need to refresh an iframe with asynchronous time intervals. The asynchronous time interval is calculated in the server side. Also, the user shouldn\'t able to feel the refresh in the whole page. It

I need to refresh an iframe with asynchronous time intervals. The asynchronous time interval is calculated in the server side. Also, the user shouldn't able to feel the refresh in the whole page. It is ok if he finds that the iframe 开发者_运维百科is refreshing in certain intervals.


If you don't want to see a status bar then you need to implement an AJAX request/callback and update the content that way.

You can always get the html page as an AJAX response and update the content of the iframe with that response.

This article details exactly what you are trying to do.


If the iframe is a page in your site, use a meta tag on the page showing in the iframe

<meta http-equiv="refresh" content="60">

content is in seconds

UPDATE

If using PHP

<meta http-equiv="refresh" content="<?=$refresh_interval?>">

Where $$refresh_interval holds the value of refresh interval according to the server

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号