window.location -- in a blank window....

Discussion in 'Javascript' started by Frances Del Rio, Jul 22, 2004.

  1. I'm trying to open a url in a new window while pg loads (but NOT in a
    pop-up..) I need to do sthg like

    // while pg is loading..

    window.location ='page.html'
    // but I need this to open in a new blank window..
    // (NOT in a pop-up, a regular new window..)

    can you do this?? thank you..

    Frances Del Rio
     
    Frances Del Rio, Jul 22, 2004
    #1
    1. Advertising

  2. Frances Del Rio wrote:

    > I'm trying to open a url in a new window while pg loads (but NOT in a
    > pop-up..)


    That is a contradiction in terms. Opening a URI in a new window IS a popup.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Jul 22, 2004
    #2
    1. Advertising

  3. Frances Del Rio

    Grant Wagner Guest

    Frances Del Rio wrote:

    > I'm trying to open a url in a new window while pg loads (but NOT in a
    > pop-up..) I need to do sthg like
    >
    > // while pg is loading..
    >
    > window.location ='page.html'
    > // but I need this to open in a new blank window..
    > // (NOT in a pop-up, a regular new window..)
    >
    > can you do this?? thank you..
    >
    > Frances Del Rio


    The only difference between a "popup" and a "new windows" is the name. A
    popup is a new window, a new window is a popup.

    If you want a new window using JavaScript, just use:

    window.open('page.html', 'windowName');

    By not specifying a third parameter, you should get a new window with the
    default size, position and chrome.

    --
    Grant Wagner <>
    comp.lang.javascript FAQ - http://jibbering.com/faq
     
    Grant Wagner, Jul 22, 2004
    #3

  4. > The only difference between a "popup" and a "new windows" is the name. A
    > popup is a new window, a new window is a popup.


    Excuse me?? there is quite a difference between the two, it seems to me..
    a new blank window (opened with a regular <a href="#" target="_blank">)
    tag will not be blocked by pop-up blockers... a pop-up window opened
    with the window.open() method will.. (apart from other differences,
    like for example in a pop-up you can customize how much chrome you
    include, in a new blank window you can't.. the way you resize them (you
    can resize a new blank window, but it's done differently from how you do
    it in a pop-up, where you do it in args in window.open() method..)

    at work we use pop-ups for legitimate reasons, not for advertising...
    but we've started to come up against pop-up blockers.. I thought we
    could open new blank windows instead, which is very simple, except if
    you're trying to do window.location upon loading and need this location
    to open in a new blank window instead of in same window (the way you
    would do in <a href="#" target="_blank"> thank you all for your
    response.. still am hoping to find a solution to this problem.. Frances
     
    Frances Del Rio, Jul 22, 2004
    #4
  5. Frances Del Rio <> writes:

    > Excuse me?? there is quite a difference between the two, it seems to me..
    > a new blank window (opened with a regular <a href="#"
    > target="_blank">) tag will not be blocked by pop-up blockers... a
    > pop-up window opened with the window.open() method will..


    That dependes on the popup blocker. Some block any new window, no
    matter how it was created. Some won't block all script-derived new
    windows. Some block windows depending on whether they come from
    a user interaction or not.

    > at work we use pop-ups for legitimate reasons, not for
    > advertising... but we've started to come up against pop-up blockers..


    Fighting against popup-blockers is a losing battle. (That makes it
    winning, for us on the other side :)

    > I thought we could open new blank windows instead, which is very
    > simple,


    So, this should create a "non-popup" popup:

    <a href="somelink.html" target="winname" id="foo"></a>
    <script type="text/javascript">
    document.links['foo'].click();
    </script>

    My bet at least some popup-blocker will block that too ...

    and testing ...

    Yes, blocked in Mozilla FireFox. Not blocked in Opera (damn!). No
    blocker in IE yet.

    > except if you're trying to do window.location upon loading and
    > need this location to open in a new blank window instead of in same
    > window


    Hmm, I don't think I understand what you are trying to do.

    /L
    --
    Lasse Reichstein Nielsen -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Jul 22, 2004
    #5
  6. Frances Del Rio

    kaeli Guest

    In article <>, enlightened
    us with...
    >
    > > The only difference between a "popup" and a "new windows" is the name. A
    > > popup is a new window, a new window is a popup.

    >
    > Excuse me?? there is quite a difference between the two, it seems to me..
    > a new blank window (opened with a regular <a href="#" target="_blank">)


    That's HTML, not javascript.
    And its use is discouraged on the internet. The internet is accessible
    by many user agents, not just MSIE browser. ;)
    Actually, if you used a strict doctype, you wouldn't be able to use the
    target anyway. (You ARE using a doctype, right?)

    A popup is any window opened by script, be it javascript or vbscript or
    Flash. Unrequested popups are the ones people block most often. That
    means they opened without the user clicking on anything or initiating
    some event.
    A "new window" doesn't even exist in some user agents.

    As to blockers, MOST won't block a new window opened as a direct result
    of a user click, mouse action, or keypress. Perhaps your functions need
    a re-write. You should not be opening unrequested windows. The function
    that is fired when the user clicks has to be the one with the open in
    it. I've had the most luck doing that, but my main browsers of concern
    are Mozilla/Netscape/Firefox/Opera with the option to disallow
    unrequested popups. I have not tested that in all the blockers available
    for MSIE. Some of them block ALL calls to window.open.

    Note that giving something a target in HTML doesn't guarantee it will
    open in a new window. I can change that with my browser (mozilla) and
    open it in a tab or set it to open in the current window and ignore your
    target.

    The only way to open a window in javascript is with window.open. There
    is no magic other way that won't be blocked.

    I have yet to see something that uses popups that truly requires them.

    --
    --
    ~kaeli~
    A hangover is the wrath of grapes.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
     
    kaeli, Jul 22, 2004
    #6
  7. Frances Del Rio

    Grant Wagner Guest

    Frances Del Rio wrote:

    > > The only difference between a "popup" and a "new windows" is the name. A
    > > popup is a new window, a new window is a popup.

    >
    > Excuse me?? there is quite a difference between the two, it seems to me..
    > a new blank window (opened with a regular <a href="#" target="_blank">)
    > tag will not be blocked by pop-up blockers... a pop-up window opened
    > with the window.open() method will..


    No, there is no difference between a new window and a popup.

    There is a difference between a window opened by the browser as a result of
    specifying a TARGET attribute on an <A> tag and a window opened
    programmatically using client-side JavaScript.

    There is even a difference between programmatically opened windows that were
    opened as the result of some user action (such as clicking a link) and
    programmatically opened windows which opened as the result of event beyond the
    user's control (such as the page loading). In some cases a "popup blocker"
    will block the latter, but not the former, in other cases, a "popup blocker"
    considers them both unacceptable.

    As for myself, my "popup blocking mechanism" even considers <a href="..."
    target="_blank"> unacceptable and refuses to open such links in a new window
    unless I specifically allow it.

    > at work we use pop-ups for legitimate reasons, not for advertising...
    > but we've started to come up against pop-up blockers.. I thought we
    > could open new blank windows instead, which is very simple, except if
    > you're trying to do window.location upon loading and need this location
    > to open in a new blank window instead of in same window (the way you
    > would do in <a href="#" target="_blank"> thank you all for your
    > response.. still am hoping to find a solution to this problem.. Frances


    As has already been discussed, there is no solution. Stop using
    programmatically opened windows. Or stop using code that opens new windows
    without the user explicitly requesting one (which will get you past some, but
    not all "popup blockers"). Ultimately you will have to abandon any attempt to
    control your users' desktops, so you may as well start now instead of trying
    to find a bubblegum and paperclip solution to the problem.

    --
    Grant Wagner <>
    comp.lang.javascript FAQ - http://jibbering.com/faq
     
    Grant Wagner, Jul 22, 2004
    #7
  8. Frances Del Rio wrote:
    >> The only difference between a "popup" and a "new windows" is
    >> the name. A popup is a new window, a new window is a popup.

    >
    > Excuse me?? there is quite a difference between the two, it seems
    > to me.. a new blank window (opened with a regular <a href="#"
    > target="_blank">) tag will not be blocked by pop-up blockers...
    > a pop-up window opened with the window.open() method will..

    <snip>

    The last resort of those that will not abandon the practice of
    attempting to open new windows is to appeal to the notion of the
    "requested" pop-up. Unfortunately different pop-up blocking mechanisms
    have different notions of what is to be considered "requested" and some
    make no distinction at all:-

    <URL: http://www.litotes.demon.co.uk/js_info/pop_ups.html >

    Richard.
     
    Richard Cornford, Jul 22, 2004
    #8
  9. ok, I thank everyone for their comments/feedback... but I'd like to say
    that where I work, we're an internet co. that mainly produces webcasts
    for Fortune 500 cos., trade associations, some non-profits... we use
    pop-ups for the video displays, we open a window that's approx 790x530,
    on the left side is the video, on the right images that flip (or are
    flipped by user) as video progresses.. this is a perfectly legitimate
    use of pop-up windows.. there's no way we can do this in same window
    where users register, login, etc (that has a nav frame on the left and
    on main frame pgs for registration, login, etc..) if you go to
    www.foxnews.com and scroll down to where it says "News 24/7" and click
    on a video link you will see what I mean.. our media viewer windows are
    more or less the same size, and have a similar layout (ours look better,
    though.. ;) and of course they have no advertising..)

    so: yes, it IS a drag that advertisers are abusing this function,
    because I personally find pop-ups really neat, I think you can design
    good UI w/them if you use them right.. I have been doing HTML for about
    10 years now, and have used them a lot in my personal website also
    (www.francesdelrio.com) (& practically all of them are opened by user..)

    and the thing is, going back to my situation at work, if a user goes to
    main page and our sw detects this user is already registered and we have
    their password stored or whatever this video viewer pops up
    automatically, w/out any input from user, while pg is still loading in
    many cases.. this is where the problem arises.. so I came up w/idea
    that instead of a pop-up opened w/window.open() method we could open the
    video viewer in a regular new blank window, <a href="__"
    target="_blank"> and resize... but how do you do this while page is
    loading (w/o input from user??)

    ok, I think I've written enough for now... ;)

    Frances



    kaeli wrote:

    > In article <>, enlightened
    > us with...
    >
    >>>The only difference between a "popup" and a "new windows" is the name. A
    >>>popup is a new window, a new window is a popup.

    >>
    >>Excuse me?? there is quite a difference between the two, it seems to me..
    >>a new blank window (opened with a regular <a href="#" target="_blank">)

    >
    >
    > That's HTML, not javascript.
    > And its use is discouraged on the internet. The internet is accessible
    > by many user agents, not just MSIE browser. ;)
    > Actually, if you used a strict doctype, you wouldn't be able to use the
    > target anyway. (You ARE using a doctype, right?)
    >
    > A popup is any window opened by script, be it javascript or vbscript or
    > Flash. Unrequested popups are the ones people block most often. That
    > means they opened without the user clicking on anything or initiating
    > some event.
    > A "new window" doesn't even exist in some user agents.
    >
    > As to blockers, MOST won't block a new window opened as a direct result
    > of a user click, mouse action, or keypress. Perhaps your functions need
    > a re-write. You should not be opening unrequested windows. The function
    > that is fired when the user clicks has to be the one with the open in
    > it. I've had the most luck doing that, but my main browsers of concern
    > are Mozilla/Netscape/Firefox/Opera with the option to disallow
    > unrequested popups. I have not tested that in all the blockers available
    > for MSIE. Some of them block ALL calls to window.open.
    >
    > Note that giving something a target in HTML doesn't guarantee it will
    > open in a new window. I can change that with my browser (mozilla) and
    > open it in a tab or set it to open in the current window and ignore your
    > target.
    >
    > The only way to open a window in javascript is with window.open. There
    > is no magic other way that won't be blocked.
    >
    > I have yet to see something that uses popups that truly requires them.
    >
     
    Frances Del Rio, Jul 23, 2004
    #9
  10. Frances Del Rio <> writes:

    > so I came up w/idea that instead of a pop-up opened w/window.open()
    > method we could open the video viewer in a regular new blank window,
    > <a href="__" target="_blank"> and resize... but how do you do this
    > while page is loading (w/o input from user??)


    You can *try*:

    <a href="..." target="_blank" id="foo"></a>
    <script type="text/javascript">
    document.links['foo'].click();
    </script>


    Won't work in all browsers, though.
    /L
    --
    Lasse Reichstein Nielsen -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Jul 23, 2004
    #10
  11. Frances Del Rio wrote:
    > ok, I thank everyone for their comments/feedback... but I'd like to say
    > that where I work, we're an internet co. that mainly produces webcasts
    > for Fortune 500 cos., trade associations, some non-profits... we use
    > pop-ups for the video displays, we open a window that's approx 790x530,


    What if the user has a desktop size that does not allow such large windows
    to be opened?

    > on the left side is the video, on the right images that flip (or are
    > flipped by user) as video progresses.. this is a perfectly legitimate
    > use of pop-up windows..


    No, it is not. Pop-ups are a Bad Thing. They eat much more resources than
    required if abandoned.

    > there's no way we can do this in same window where users register, login,


    There is. You are obviously not competent enough to make design decisions.
    Get yourself educated.

    > etc (that has a nav frame on the left and on main frame pgs for
    > registration, login, etc..)


    Frames are a Bad Thing. Use CSS and fixed layers instead.
    This even works in IE with a small workaround.

    > if you go to www.foxnews.com and scroll down to where it says
    > "News 24/7" and click on a video link you will see what I mean..


    Doing Bad Things just because others do Bad Things has never been
    a reasonable excuse, if that.

    > [more incompetent blabla]


    What you like or dislike is irrelevant. If you design/hack for a
    customer, what the customer wants when it comes to such design
    decisions should be irrelevant (and it is your job to explain why).
    Functionality is relevant. The fish must eat the worm, not the
    fisher.

    > and the thing is, going back to my situation at work, if a user goes to
    > main page and our sw detects this user is already registered and we have
    > their password stored or whatever this video viewer pops up
    > automatically, w/out any input from user, while pg is still loading in
    > many cases.. this is where the problem arises..


    The problem arises *at least* with Windows XP Service Pack 2
    which finally causes the (alas!) most used browser today to
    block unrequested popups *by default*.

    > [...]
    > ok, I think I've written enough for now... ;)
    > [...]


    And if you would saved us from that top-post, too, as strongly
    recommended in the FAQ, it would be more appreciated.


    PointedEars
     
    Thomas 'PointedEars' Lahn, Jul 26, 2004
    #11
  12. Frances Del Rio

    kaeli Guest

    In article <>, enlightened us
    with...
    >
    > ok, I thank everyone for their comments/feedback... but I'd like to say
    > that where I work, we're an internet co. that mainly produces webcasts
    > for Fortune 500 cos., trade associations, some non-profits... we use
    > pop-ups for the video displays, we open a window that's approx 790x530,
    > on the left side is the video, on the right images that flip (or are
    > flipped by user) as video progresses.. this is a perfectly legitimate
    > use of pop-up windows..


    Yes, it is, and it's used by a lot of multimedia and game sites, all of which
    (from what I've noticed, anyway) have a disclaimer that effectively tells
    people that they use popups and to turn off their blocker or control+click
    (for some blockers) to allow the popups. :)
    Heck, my favorite game spot uses popups and applets, two things I usually
    tell people NOT to use. *smile*
    If your content is worth it, you tell users about it and they'll decide they
    like you enough to turn off blocking for you.

    All blockers have a way to allow popups by some means. Some are
    control+click, some you have to add the site to a list of allowed sites, etc.

    There really isn't a good way around this issue. You just have to inform the
    user about it and let them decide if they want to use your site by turning
    off popup blocking or not.

    My two cents...

    --
    --
    ~kaeli~
    Is it possible to be totally partial?
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
     
    kaeli, Jul 26, 2004
    #12
  13. Frances Del Rio

    Grant Wagner Guest

    Andrew Thompson wrote:

    > On Mon, 26 Jul 2004 05:52:31 +0200, Thomas 'PointedEars' Lahn wrote:
    >
    > > The problem arises *at least* with Windows XP Service Pack 2
    > > which finally causes the (alas!) most used browser today to
    > > block unrequested popups *by default*.

    >
    > Cool. I had previously rejected any attempt
    > (by the system) to update.. But that one is
    > *worth* it! I hit a page the other day that
    > had 2 pop-ups and 3 pop-unders.. :-O


    Use a Gecko-based browser and get popup blocking built-in. Or if you
    must use IE, install the Google toolbar <url: http://toolbar.google.com/
    />. It blocks most (but not all) popups.

    --
    Grant Wagner <>
    comp.lang.javascript FAQ - http://jibbering.com/faq
     
    Grant Wagner, Jul 26, 2004
    #13
    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. Luke Dalessandro
    Replies:
    0
    Views:
    618
    Luke Dalessandro
    Jan 15, 2006
  2. zxo102
    Replies:
    0
    Views:
    423
    zxo102
    Aug 1, 2006
  3. Ravi
    Replies:
    2
    Views:
    168
    Ravi Muthyala
    Feb 6, 2004
  4. saiho.yuen
    Replies:
    3
    Views:
    446
    kaeli
    Sep 14, 2004
  5. John Bailo

    IE7 shows location even if location=no

    John Bailo, Jan 19, 2007, in forum: Javascript
    Replies:
    4
    Views:
    185
    OmegaJunior
    Mar 11, 2007
Loading...

Share This Page