www.webdeveloper.com
Results 1 to 2 of 2

Thread: Browser window

  1. #1
    Join Date
    Jul 2013
    Posts
    2

    Browser window

    Hello to all i need to open new browser window automatically.
    Here is code where i have to click on button to open window :
    <!DOCTYPE html>
    <html>
    <head>
    <script>
    function openWin()
    {
    myWindow=window.open('','','width=200,height=100');
    myWindow.document.write("<p>This is 'myWindow'</p>");
    myWindow.focus();
    }
    </script>
    </head>
    <body>

    <input type="button" value="Open window" onclick="openWin()" />

    </body>
    </html>

    Please how i can open window , without clicking on button so window just open automatically ?
    Thank You

  2. #2
    Join Date
    Mar 2011
    Posts
    1,135
    Technically, you could simply put your window.open() code in the <body> or use an onload event to call your openWin function, but the pop-up blockers in most browsers will prevent a new window from opening automatically without an explicit user action like a click on a button.
    Rick Trethewey
    Rainbo Design

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles