How To Remove an Address Bar With JavaScript

104 9
    • 1). Create a JavaScript tab and function in the webpage. A script tag is used to denote JavaScript in a webpage. The following code sets up the JavaScript block:
      <script language="javascript">
      function openMyWindow() {
      }
      </script>

    • 2). Add the open method without the browser's address bar. The following code shows how to open a new window with no address and status bar. It also sets the window's size at 350 by 350 pixels. The page used in the window is "myPopupAd.html" and the name shown is "My Popup Window":
      <script language="javascript">
      function openMyWindow() {
      window.open ("myPopupAd.html", "My Popup Window", "height=350,width=350,status=no,toolbar=no,menubar=no");
      }
      </script>

    • 3). Add the pop-up window in the body tag of the HTML file. Pop-up ads are normally presented when the user accesses the web page. This is accomplished using the body tag. The code to complete the pop-up ad process is below.
      <body onload="openMyWindow();">
      This page loads a pop-up window.
      </body>

    • 4). Load the pop-up when a user clicks a button. You can also accomplish a pop-up when the user clicks an object on the web page. Below is the code to capture an "onclick" event in a button.
      <button onclick="openMyWindow():">Click Me!</button>

Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.