Notice: Due to size constraints and loading performance considerations, scripts referenced in blog posts are not attached directly. To request access, please complete the following form: Script Request Form Note: A Google account is required to access the form.
Disclaimer: I do not accept responsibility for any issues arising from scripts being run without adequate understanding. It is the user's responsibility to review and assess any code before execution. More information

HTML : Open a new windows for x number of seconds

 I had a requirement to open a new window for a certain amount of time then close it again, this was to be used for a "welcome message" that needed to remain persistant on the screen.

I did this to get it working, for this the following code goes in the "head" HTML tag:

<script type="text/javascript">

function allOn(){

var myWindow = window.open('http://fakesite.a6n.co.uk','1366002941508','width=1024,height=768,left=5,top=3')

setTimeout(function() { myWindow.close();}, 5000);

}

  </script>


Then when you need to call this function you need to add this as a link in the BODY:

<input type=submit value="Accept these conditions" onclick="allOn();" />

In this example this would open a new windows for 5 seconds and close it, sometimes java can be cool, this is one of those times.

If you would like it to scale the the size of the window you have open before then chnage this:

'width=1024,height=768,left=5,top=3'

to this

'"width=" + screen.width + ",height=" + screen.height,left=5,top=3'

Previous Post Next Post

نموذج الاتصال