How to refresh iframe after regular interval in HTML


pin up

I want to automatically refresh an iframe that loads a php page, but refresh the whole page instead of just the iframe.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fouad Ali</title>
<script>
var links = "/proj/index.php";
var i = 0;
var renew = setInterval(function(){
    document.getElementById("foo").src = links;        
  // alert("refreshed");
},5000);
</script>
</head>

<body>
<iframe id="foo" src="/proj/index.php"></iframe>
</body>
</html>
Ashish ranade

try this:

<script>
   var src = $('#foo').attr('src');
   setInterval(function () {
        $('#foo').remove();
        var iframe_html = '<iframe src="'+ src +'" width="100%" height="100%"></iframe>';
        $('#iframe').html(iframe_html);
    }, 1000);
</script>
<span id="iframe">
    <iframe id="foo" src="http://www.google.com" width="100%" height="100%"></iframe>
</span>

If you're using any server side language, the page always looks like it's refreshing itself, but if you check the network calls to the page, it will show your page one hit and repeated hits for the iframe src. Hope this will help you.

Related


How to refresh iframe after regular interval in HTML

pin up I want to automatically refresh an iframe that loads a php page, but refresh the whole page instead of just the iframe. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns

How to refresh a jsp page after a given time (or interval)?

Abhijit Bashetti I want to refresh/reload my jsp page after a certain interval. Consider a time interval of 5 minutes. How to achieve it? Abishek you can use itpublic void setIntHeader(String header, int headerValue) response.setIntHeader("Refresh",300) This

How to refresh a jsp page after a given time (or interval)?

Abhijit Bashetti I want to refresh/reload my jsp page after a certain interval. Consider a time interval of 5 minutes. How to achieve it? Abishek you can use itpublic void setIntHeader(String header, int headerValue) response.setIntHeader("Refresh",300) This

How to refresh a jsp page after a given time (or interval)?

Abhijit Bashetti I want to refresh/reload my jsp page after a certain interval. Consider a time interval of 5 minutes. How to achieve it? Abishek you can use itpublic void setIntHeader(String header, int headerValue) response.setIntHeader("Refresh",300) This

How to refresh a jsp page after a given time (or interval)?

Abhijit Bashetti I want to refresh/reload my jsp page after a certain interval. Consider a time interval of 5 minutes. How to achieve it? Abishek you can use itpublic void setIntHeader(String header, int headerValue) response.setIntHeader("Refresh",300) This

How to control the refresh interval

Navnish Bhardwaj I have an intranet site with WordPress 3.6 hosted on Centos 6.4. I have noticed that when users visit an intranet site, after viewing certain pages, keep their browser open, their browser will refresh the intranet site after 5 seconds. In my i

How to control the refresh interval

Navnish Bhardwaj I have an intranet site with WordPress 3.6 hosted on Centos 6.4. I have noticed that when users visit an intranet site, after viewing certain pages, keep their browser open, their browser will refresh the intranet site after 5 seconds. In my i

How to refresh iframe url?

test user I'm using ionic to create an app where iframes are being used to display URLs. Here is the HTML code: <iframe id="myFrame" width="100%" height={{iframeHeight}}> Here is the angular js: $scope.iframeHeight = window.innerHeight;

How to refresh iframe url?

test user I'm using ionic to create an app where iframes are being used to display URLs. Here is the HTML code: <iframe id="myFrame" width="100%" height={{iframeHeight}}> Here is the angular js: $scope.iframeHeight = window.innerHeight;

How to refresh iframe url?

test user I'm using ionic to create an app where iframes are being used to display URLs. Here is the HTML code: <iframe id="myFrame" width="100%" height={{iframeHeight}}> Here is the angular js: $scope.iframeHeight = window.innerHeight;

How to refresh HTML after AJAX post

username I have a website where guests can log in via a modal form. The solution I came up with is working, but I feel like it's a dirty/unsafe approach. In the main layout, I load the partial view that contains the modal form. When the user is authenticated,

How to refresh HTML after AJAX post

username I have a website where guests can log in via a modal form. The solution I came up with is working, but I feel like it's a dirty/unsafe approach. In the main layout, I load the partial view that contains the modal form. When the user is authenticated,

How to load html file into iframe after uploading?

Duwi irwanto I am trying to upload html file when i upload i want his to be displayed in iframe or object. HTML <form id="myForm" action="accept-file.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" /> <br> <div cl

How to get regular interval count

Production So I have data in the following format const data = [ { date: '01-07-2019' }, { date: '02-07-2019' }, { date: '03-07-2019' }, { date: '04-07-2019' }, { date: '05-07-2019' }, { date: '06-07-2019' }, { date: '07-07-2019' }, { date: '08

How to refresh an IFrame using JavaScript?

Elitmiar I have a webpage with an IFrame and a Button, once the button is pressed, I need to refresh the IFrame. If possible, is this possible? I searched and couldn't find any answer. kjagiello : var iframe = document.getElementById('youriframe'); iframe.src

How to refresh an IFrame using JavaScript?

Elitmiar I have a webpage with an IFrame and a Button, once the button is pressed, I need to refresh the IFrame. If possible, is this possible? I searched and couldn't find any answer. kjagiello : var iframe = document.getElementById('youriframe'); iframe.src

How to refresh an IFrame using JavaScript?

Elitmiar I have a webpage with an IFrame and a Button, once the button is pressed, I need to refresh the IFrame. If possible, is this possible? I searched and couldn't find any answer. kjagiello : var iframe = document.getElementById('youriframe'); iframe.src

How to refresh HTML table after doing POST request in ngOnInit()?

username Once the component is accessed invoices.ts, it will look for some updates in the background and apply them to the existing ones. Otherwise, when the user does not have existing invoices, it will perform a POST request to create them. However, when the

How to refresh HTML table after doing POST request in ngOnInit()?

username Once the component is accessed invoices.ts, it will look for some updates in the background and apply them to the existing ones. Otherwise, when the user does not have existing invoices, it will perform a POST request to create them. However, when the