Skip to content

Instantly share code, notes, and snippets.

@beames
Created August 22, 2014 13:14
Show Gist options
  • Save beames/7c7fb8e2b9d46b253fad to your computer and use it in GitHub Desktop.
Save beames/7c7fb8e2b9d46b253fad to your computer and use it in GitHub Desktop.
reload page jsbin reload page // source http://jsbin.com/piyur/6
<!doctype html>
<html lang="en">
<head>
<meta name="description" content="jsbin reload page" />
<meta charset="UTF-8">
<title>reload page</title>
</head>
<body>
<script>
url='http://localhost:1337'
</script>
<iframe src=url frameborder="0"></iframe>
<script>
setInterval(function(){
//remove iframe dom
var iframe = document.getElementsByTagName("iframe");
iframe[0].parentNode.removeChild(iframe[0]);
// create iframe dom
iframe = document.createElement('iframe');
iframe.setAttribute("src", url);
iframe.setAttribute("frameborder", "0");
document.body.appendChild(iframe);
},1000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment