open new window in background : is it possible?

Discussion in 'Javascript' started by HopfZ, Jan 10, 2007.

  1. HopfZ

    HopfZ Guest

    Is it possible to open an external page in background?

    window.open('http://www.google.com/search?q='+Math.random());
    window.focus();

    I tried the above code in three browsers:

    Firefox 2 - opens google in new tab. but focus does not get back to the
    original tab. Firefox behaves as if window.focus() is not there.
    Opera 9 - opens google in new background tab. Good.
    IE 7 - new window appears, then soon original window is focused back,
    when the new window completes loading it gets focus again.

    Possible only in Opera?
    HopfZ, Jan 10, 2007
    #1
    1. Advertising

  2. HopfZ

    Lee Guest

    HopfZ said:
    >
    >Is it possible to open an external page in background?
    >
    >window.open('http://www.google.com/search?q='+Math.random());
    >window.focus();
    >
    >I tried the above code in three browsers:
    >
    >Firefox 2 - opens google in new tab. but focus does not get back to the
    >original tab. Firefox behaves as if window.focus() is not there.
    >Opera 9 - opens google in new background tab. Good.
    >IE 7 - new window appears, then soon original window is focused back,
    >when the new window completes loading it gets focus again.
    >
    >Possible only in Opera?


    By default, I believe Firefox blocks scripts from focus()ing windows.
    IE probably has the same security option.
    Opening a window that the user can't see is assumed to be malicious.


    --
    Lee, Jan 10, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gordon
    Replies:
    3
    Views:
    289
    Steven Burn
    Apr 16, 2004
  2. PC HUA
    Replies:
    2
    Views:
    394
    PC HUA
    May 19, 2004
  3. Paul
    Replies:
    5
    Views:
    428
    Eric J. Roode
    Dec 7, 2005
  4. Berlin  Brown

    Selection; open popup or open a new window

    Berlin Brown, Jun 26, 2006, in forum: Javascript
    Replies:
    0
    Views:
    110
    Berlin Brown
    Jun 26, 2006
  5. Replies:
    1
    Views:
    226
Loading...

Share This Page