FAQ Topic - How do I open a new window with javascript? (2008-03-27)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • FAQ server

    FAQ Topic - How do I open a new window with javascript? (2008-03-27)

    -----------------------------------------------------------------------
    FAQ Topic - How do I open a new window with javascript?
    -----------------------------------------------------------------------

    New windows can be opened on browsers that support the
    ` window.open ` function and are not subject to the action of any
    pop-up blocking mechanism with code such as:-

    if(window.open) {
    wRef = window.open("ht tp://example.com/page.html","win dowName");
    }

    The open() method of the Window interface loads a specified resource into a new or existing browsing context (that is, a tab, a window, or an iframe) under a specified name.





    --
    Postings such as this are automatically sent once a day. Their
    goal is to answer repeated questions, and to offer the content to
    the community for continuous evaluation/improvement. The complete
    comp.lang.javas cript FAQ is at http://jibbering.com/faq/index.html.
    The FAQ workers are a group of volunteers. The sendings of these
    daily posts are proficiently hosted by http://www.pair.com.

  • Dr J R Stockton

    #2
    Re: FAQ Topic - How do I open a new window with javascript? (2008-03-27)

    In comp.lang.javas cript message <47eae387$0$902 67$14726298@new s.sunsite.
    dk>, Thu, 27 Mar 2008 00:00:02, FAQ server <javascript@dot internet.be>
    posted:
    >-----------------------------------------------------------------------
    >FAQ Topic - How do I open a new window with javascript?
    >-----------------------------------------------------------------------
    >
    >New windows can be opened on browsers that support the
    >` window.open ` function and are not subject to the action of any
    >pop-up blocking mechanism with code such as:-
    >
    if(window.open) {
    wRef = window.open("ht tp://example.com/page.html","win dowName");
    }
    >
    >http://developer.mozilla.org/en/docs/DOM:window.open
    >
    >http://www.infimum.dk/HTML/JSwindows.html

    That needs re-thinking and re-writing.

    My MS IE 7 is certainly subject to the action of a pop-up blocking
    mechanism, yet it can certainly open new windows.

    There seems to be four (or more) distinct cases to consider : the first
    parameter of window.open can be an empty string (""), or it can be a
    relative reference ("sibling.htm") , or it can be a full reference
    ("http://...") to the same site, or it can be a full reference
    ("http://...") to a different site.

    As a first step, I suggest (note spaces in code, for legibility) :


    New windows can be opened on browsers that support the ` window.open `
    method with code such as :-

    if (window.open)
    wRef = window.open(
    "http://example.com/page.html", "windowName ", "windowFeatures ")

    Opening new windows is often prevented by a pop-up blocker.

    --
    (c) John Stockton, nr London UK. ?@merlyn.demon. co.uk BP7, Delphi 3 & 2006.
    <URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
    <URL:http://www.bancoems.co m/CompLangPascalD elphiMisc-MiniFAQ.htmclpd mFAQ;
    <URL:http://www.borland.com/newsgroups/guide.htmlnews: borland.* Guidelines

    Comment

    Working...