Skip Navigation.

NWE Help: Web: Authoring: Tips: Automatic Pop Up

NWE Home :: Help :: Web :: Authoring :: HTML :: Tips

Although they can be quite annoying, automatic popup windows can also be effective in web design. Automatic popup windows are windows that open without anyone clicking on a link or activating a link in anway. As soon as the main page loads in the broswer, the popup window loads as well.

To make an automatic popup window, copy the following code into your HTML document and save this as the page:

<html>
<title>TITLE</title>
<head>
<script>

// (C) 2001 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header

var theURL = 'popup.html';
var width  = 300;
var height = 400;

function popWindow() {
newWindow = window.open(theURL,'newWindow','toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no,width='+width+',height='+height);
}

</script>
</head>
<body onload="popWindow()">


</body>
</html>
Where you see var theURL="popup.html" put the name of whatever page that you want to popup. If you have a page called X.html, then that part of the script needs to read: var theURL="X.html".

If you want to change the size of the window, play with the width and height dimensions just under where you insert the page name.

And that's all you need to do--other than turning off any popup blockers that would prevent this from working. See this test page if you'd like to see it work.