javascript - Browser should keep refreshing the iframe -- not working -


i've page shows network status. refreshing self after 1 minute or so. when can't load page display blank page , stays there when load page.

to solve i've placed network status page(status.php) within iframe , parent page(index.html) should keep reloading network status page within iframe after 1-2 minutes.

i've written code:

<!docttype html> <head>  <script>  console.log("running window.log"); window.setinterval(function(){ reloadiframe(); }, 10000);  function reloadiframe() { console.log("reloaded frame");  window.frames[0].location.reload(); }  </script> </head>  <body> <iframe  frameborder=0 name="frame11" width="100%" height="100%" src="status.php"> </iframe> 

now when disable network connection, page(index.html) going blank showing on chrome: "the internet connection has been lost." message in console:

uncaught securityerror: blocked frame origin "http://upordown.example.com" accessing frame origin "null". frame requesting access has protocol of "http", frame being accessed has protocol of "data". protocols must match.

how solve problem? parent page should keep loading child frame , @ least parent frame should work whether or network connection there or not.

this code has made work:

window.setinterval(function(){ reloadiframe(); }, 90000);  function reloadiframe() {  var url = "status.php"+"?rand="+new date().gettime();  $.get( url, function( data ) {   $( "#frame1" ).html( data );   $("#frame1").contents().find('html').html(data);  }); } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -