Results 1 to 2 of 2

Thread: Open external website onload?

  1. #1
    Join Date
    Mar 2013

    Open external website onload?

    I would like to open/link an external webpage onload in a new tab...

    I am using this:
    <body onload=window.location='SITE_URL_HERE'>

    This works, but re-directs the page rather than open a new tab.

    What would I include so that it does this in a new tab?


  2. #2
    Join Date
    Mar 2011
    You should use window.open() for this. See http://www.w3schools.com/jsref/met_win_open.asp. The code would be something like:
    <body onload="window.open('SITE_URL_HERE');">
    However, as you can see, this code creates a new pop-up window and will be blocked by many browser pop-up blockers. You can't force a new tab. It's a user-settable option that determines if a new window is created or the page is loaded in a new browser tab.
    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