How to Hide the Address Bar in a Popup Window

Save

Using JavaScript, you can create several styles of popup window, including one without an address bar. You add the code to an existing Web page, and the popup is programmed to load when the page opens or closes, or when the user clicks on a link or button. Some browsers, notably Internet Explorer version 7 and later, consider that hiding the address bar can create security issues and will override the code to display the bar.

  • Open your HTML file in a plain text or HTML editor. Use Notepad, which is in the "Programs" folder under "Accessories," or use your usual HTML editing software in "code" mode.

  • Type the following code immediately before the closing </HEAD> tag:

    <SCRIPT LANGUAGE="JavaScript">

    function OpenPopup()

    {

    window.open ("", "popup", "location=no,status=yes,scrollbars=yes,toolbar=no,menubar=no,width=350,height=350");

    }

    </SCRIPT>

    The code provided opens a popup called "popup" with a status bar and scrollbars, but no address bar, toolbar or menubar. The popup will be 350 x 350 pixels in size. In Internet Explorer version 7 and later, the address bar will show but the navigation bar will be hidden.

  • Add the following code to the opening <BODY> tag to open the popup window as the page loads:

    <BODY onload="OpenPopup();">

  • Save your file and upload it to your website. Open the page in your browser and the popup window will open automatically.

References

Promoted By Zergnet

Comments

Resources

You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!