Links take over browser window.

Discussion in 'Javascript' started by Simon Wigzell, Jan 24, 2004.

  1. Is there any way to create and open a window in javascript so that links in
    other websites won't "steal" it?

    I've written a web page with a form for people to enter headlines and URLs
    from newspapers. They will want my window to stay there as they surf through
    various online newspapers. We don't want their popup links to take over my
    form window!

    This is a real problem - it renders my web page useless and wastes peoples
    time.

    It ought to be illegal for a web page to steal other web page windows!

    Thanks for any help.
    Simon Wigzell, Jan 24, 2004
    #1
    1. Advertising

  2. "Simon Wigzell" <> writes:

    > Is there any way to create and open a window in javascript so that links in
    > other websites won't "steal" it?


    I don't understand what you mean by "steal".

    You create/open windows using window.open (unless the user is using a
    popup blocker)

    > I've written a web page with a form for people to enter headlines and URLs
    > from newspapers. They will want my window to stay there


    Stay where?

    > as they surf through various online newspapers. We don't want their
    > popup links to take over my form window!


    What is a popup link? Is it a link that opens a popup? In that case,
    they will only take over your form window if they request a popup with
    the same window name as oyur window.

    > This is a real problem - it renders my web page useless and wastes peoples
    > time.


    > It ought to be illegal for a web page to steal other web page windows!


    I still don't understand what the problem is. Could you try explining
    it more precisely: what windows do you have, what does the user do,
    and what is the effect?

    When you click on a link in a window, the page the link refers to is
    opened in the same window. That is how the web normally work, and how
    it is supposed to work. If the user wants to open the link in a different
    window, he'll use his right click menu and chose "open in new window".

    /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, Jan 24, 2004
    #2
    1. Advertising

  3. I don't understand the confusion! If a web page has a link that uses
    javascript to pop up a web page in a new browser window, and there are other
    browser windows around, the new web page will appear in one of the other
    open browser windows. In this case one of the other open browser windows is
    my online form webpage. I have no control or even knowledge of the webpage
    that is opening other web pages in my window. So my question is, is there a
    way in javascript that I can create my window such that it won't get taken
    over? And it is a named window, and that makes no difference!
    Simon Wigzell, Jan 24, 2004
    #3
  4. "Simon Wigzell" <> wrote in message
    news:ykDQb.260435$ts4.203725@pd7tw3no...
    > I don't understand the confusion! If a web page has a link that uses
    > javascript to pop up a web page in a new browser window, and there are

    other
    > browser windows around, the new web page will appear in one of the other
    > open browser windows. In this case one of the other open browser windows

    is
    > my online form webpage. I have no control or even knowledge of the webpage
    > that is opening other web pages in my window. So my question is, is there

    a
    > way in javascript that I can create my window such that it won't get taken
    > over? And it is a named window, and that makes no difference!


    It's nothing to do with the external web page.

    It is you who has opened the new window so it is you who has given the
    window a name.

    When you open another new window it is up to you to give that window a
    different name if you don't want the existing window to be used.
    Richard Formby, Jan 24, 2004
    #4
  5. "Simon Wigzell" <> writes:

    > If a web page has a link that uses javascript to pop up a web page
    > in a new browser window, and there are other browser windows around,
    > the new web page will appear in one of the other open browser
    > windows.


    No. That *only* happens if the new window is given the *same* window
    name as the existing window. The name is given as either the "target"
    attribute on the link, or the second argument to "window.open".

    So, don't reuse names, or don't use an often-used name for your window.

    > In this case one of the other open browser windows is my
    > online form webpage. I have no control or even knowledge of the
    > webpage that is opening other web pages in my window.


    So, you must accidentally hav chosen the same window name. Change
    yours. Perhaps to "_blank", which means a new page with no name,
    so it will never be matched.

    > So my question is, is there a way in javascript that I can create my
    > window such that it won't get taken over?


    Yes, give it a non-guessable name ("MyUltraSecretWindowNameTM") or
    a non-matchable name ("_blank").

    > And it is a named window, and that makes no difference!


    It makes *all* the difference.

    /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, Jan 25, 2004
    #5
  6. Simon Wigzell

    Lee Guest

    Lasse Reichstein Nielsen said:
    >
    >"Simon Wigzell" <> writes:
    >
    >> If a web page has a link that uses javascript to pop up a web page
    >> in a new browser window, and there are other browser windows around,
    >> the new web page will appear in one of the other open browser
    >> windows.

    >
    >No. That *only* happens if the new window is given the *same* window
    >name as the existing window. The name is given as either the "target"
    >attribute on the link, or the second argument to "window.open".


    No, you've misunderstood what he's asking about.

    He's asking about links on *other* sites opening pages in
    the window in which his site is currently open.

    As an example, Friday I was filling out a web form at work.
    Before I finished, an important email message arrived,
    containing an URL that I had to look at immediately.

    I clicked on the URL, and it opened in the window that had
    contained my form. Back when I was allowed to use a better
    email client, I could have easily selected to open it in a
    new browser instance. Instead, my options were to remember
    to go BACK to what I was doing, or to open a new window so
    the URL would open in it, instead of on top of my form.
    Lee, Jan 25, 2004
    #6
  7. Lee <> writes:

    > No, you've misunderstood what he's asking about.


    Maybe :)

    > He's asking about links on *other* sites opening pages in
    > the window in which his site is currently open.


    That is what I was talking about too.

    > As an example, Friday I was filling out a web form at work.
    > Before I finished, an important email message arrived,
    > containing an URL that I had to look at immediately.
    >
    > I clicked on the URL, and it opened in the window that had
    > contained my form.


    That is a different scenario: You are not opening the link from the
    browser, but from a different application. That means that the linked
    page cannot be opened in the same window as the link, because the link
    is not in a browser window at all. Which window it is then opened in
    depends on what the application does, and how the browser handles
    requests for new pages opened by other applications.

    I would not have that problem, because my browser always opens a new
    requested page in a fresh window (I use Opera in MDI mode).

    Your scenario doesn't match the explanation, as I read it, because it
    is not another site opening the page. The word "site" makes me believe
    that it is a page in a browser that contains the link. In that case
    my explanation is (AFAIK) correct.

    Ofcourse, it could also be because the explanation fails to describe
    the problem in sufficient detail - like which browser (or even other
    applications) is involved, example of pages that shows the problem,
    etc.

    /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, Jan 25, 2004
    #7
  8. Thanks for the heated discussion! Looks like at the end there you are
    finally understanding my problem! Sorry I couldn't explain it more clearly
    sooner.

    Actually, it occurs 100% when someone clicks on a link in an email, then it
    takes over even my named window that I have popped up with javascript.

    And with one person who "logs in to ZNet" and then loses my window because
    ZNet steals it. I'm trying to get more info from him.

    I'm asking him for more information and just telling him to "log in to ZNet"
    first and then start my web page in a new browser but that seems to be
    beyond him.

    I'm not sure of the extent or the exact reproducible causes of this problem.
    Still investigating. But for sure, under certain circumstances, even a named
    window, popped up with javascript can be stolen by some other program -
    email links for sure (Outlook anyway) And my clients Znet thing.

    It should be illegal! There should be a way of opening a window so that
    nothing else can replace it's content!

    Thanks though, I'll come back when I have more info on the ZNet thing.
    Simon Wigzell, Jan 25, 2004
    #8
  9. Simon Wigzell

    Alan P Guest

    Im afraid to say, I use Outlook Express, and have a similar problem

    Everyt8me open a link, it open's it in the same window; erasing the previous
    contents

    And there's no 'Open In new winsdow' iptipn option

    "Richard Formby" <> wrote in message
    news:0DDQb.26419$...
    >
    > "Simon Wigzell" <> wrote in message
    > news:ykDQb.260435$ts4.203725@pd7tw3no...
    > > I don't understand the confusion! If a web page has a link that uses
    > > javascript to pop up a web page in a new browser window, and there are

    > other
    > > browser windows around, the new web page will appear in one of the other
    > > open browser windows. In this case one of the other open browser windows

    > is
    > > my online form webpage. I have no control or even knowledge of the

    webpage
    > > that is opening other web pages in my window. So my question is, is

    there
    > a
    > > way in javascript that I can create my window such that it won't get

    taken
    > > over? And it is a named window, and that makes no difference!

    >
    > It's nothing to do with the external web page.
    >
    > It is you who has opened the new window so it is you who has given the
    > window a name.
    >
    > When you open another new window it is up to you to give that window a
    > different name if you don't want the existing window to be used.
    >
    >
    Alan P, Jan 25, 2004
    #9
  10. On Sun, 25 Jan 2004 09:22:03 GMT, Simon Wigzell <>
    wrote:

    > Thanks for the heated discussion! Looks like at the end there you are
    > finally understanding my problem! Sorry I couldn't explain it more
    > clearly sooner.
    >
    > Actually, it occurs 100% when someone clicks on a link in an email, then
    > it takes over even my named window that I have popped up with
    > javascript.


    While I was still using IE, this occurred frequently. IE appears to
    implement a 'last window used' algorithm to decide where the content from
    externally opened URLs (from Outlook, for example) will go. So, if you
    were entering data into a form then went to another application that
    executed something that IE should handle, the content would replace that
    form. Sometimes, this didn't always happen, but it was the most consistent
    behaviour I observed.

    IE does have an option that determines whether associated files launched
    externally would start a new process, or would open in an existing window.
    In v5.5, the option is a checkbox in the advanced settings, called "Reuse
    windows for launching shortcuts". It might have been renamed in v6. Opera
    has a similar option (Windows > Reuse existing page), so I'd imagine that
    other browsers do, too. Unfortunatly, I don't think it always worked with
    IE.

    > It should be illegal!


    That's just a little over-the-top, don't you think?

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
    Michael Winter, Jan 25, 2004
    #10
  11. snip
    > > It should be illegal!

    >
    > That's just a little over-the-top, don't you think?
    >

    I meant in the same sense that my computer is always telling me "You have
    performed an illegal operation" e.g. nothing that pops up something in a
    browser can have permission to use an existing window. Thanks for the tip on
    the flag in advanced options, I'll have a look for that.
    Simon Wigzell, Jan 26, 2004
    #11
    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. John Max Skaller
    Replies:
    2
    Views:
    267
    Duncan Booth
    Sep 11, 2003
  2. DeMarcus
    Replies:
    4
    Views:
    559
    Michael Doubez
    Apr 24, 2010
  3. Replies:
    1
    Views:
    150
    Chris Withers
    Mar 4, 2012
  4. William
    Replies:
    1
    Views:
    126
    Chris Johnson
    Oct 5, 2005
  5. Ari Krupnik
    Replies:
    0
    Views:
    219
    Ari Krupnik
    Dec 3, 2006
Loading...

Share This Page