Skip to content

Instantly share code, notes, and snippets.

@shahid249
Created July 2, 2017 16:36
Show Gist options
  • Save shahid249/595e47a02758efd2f3c621ce6b005105 to your computer and use it in GitHub Desktop.
Save shahid249/595e47a02758efd2f3c621ce6b005105 to your computer and use it in GitHub Desktop.
open url in new windows and close in 5 seconds automatically - Javascripts
// put url by replacing http://example.com
//HTML Code
//<a href="javascript:void" onclick="loadUrl('http://example.com')">url</a>
<script type="text/javascript">
function loadUrl(newLocation)
{
var win = window.open(newLocation, '4536453645', 'width=500,height=200,left=375,top=330'); //adjust height weidth of window
setTimeout(function(){win.close()}, 5000);//5000 defines time 5000 = 5 sec
return false;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment