trying to close a window and open a new one without toolbars

Discussion in 'Java' started by Albretch, Jul 21, 2004.

  1. Albretch

    Albretch Guest

    Hi,

    client wants for a window with no toolbars to open (technical and
    'esthetical' reasons) after the window, user clicks on, is being
    closed.

    I told them about security settings in browsers and no cross-browsers
    solutions and all of that we know, but they have told me they have
    seen that before and how then the annoying pop-up windows work? . . .

    After reading and searching . . . I still don't see how to get it
    right

    This is what I have (see below) which is still prompts you with the
    message:

    "The Web page you are viewing is trying to close the window."

    "Do you want to close the window?"

    "[YES|NO]"

    // Page1_WithBrowswerToolbars.jsp
    // - - - - - - - - - - - - - - - - - Page1_With Browswer Toolbars

    <html>
    <head>
    <title>Page1_WithBrowswerToolbars</title>
    <script type="text/javascript" language="Javascript">
    <!--
    function newWindow(popWin){
    // __
    window.opener = self;
    window.close();
    // __
    popWindow = window.open(popWin, 'popWin',
    'width=700,height=600,resize=yes,toolbar=no,location=no,scrollbars=yes');
    popWindow.focus();
    }
    -->
    </script>
    </head>

    <body bgcolor="ffffff">
    <center><h1>Page1 With Browser Toolbars</h1>
    <br />
    <br />
    <a href="javascript:newWindow('./Page2_WithNoToolbars.jsp')">click
    here to open window with no tool bars</a>
    </center>
    </body></html>

    // Page2_WithNoToolbars.jsp
    // - - - - - - - - - - - - - - - - - Page2 With No Toolbars
    <html>
    <head>
    <title>Page2_WithNoToolbars</title>
    <script type="text/javascript" language="Javascript">
    <!--
    function CloseParent(){
    var hwnd = window.open('','Page1_WithBrowswerToolbars'); // notice,
    no page included, only the title of the window you want to hijack
    hwnd.close();
    }
    -->
    </script>

    </head>

    <body onload="CloseParent()">
    <center><h1>Page2_WithNoToolbars</h1></center>
    </body></html>

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Albretch, Jul 21, 2004
    #1
    1. Advertising

  2. On 21 Jul 2004 13:00:58 -0700, Albretch wrote:

    Read in c.l.j.programmer

    > client wants for a window with no toolbars to open


    reader wants on-topic posts

    > <script type="text/javascript" language="Javascript">


    Which this is not. What makes you think
    Java programmers are qualified or able
    to abswer JS questions? Most Java programmers
    would not even recognize the mistake in that line.

    Would you ask the baker about that problem
    you are having with the roof on your house?

    <http://groups.google.com/groups?q=group:comp.lang.javascript>

    In future, please do not post JS questions to c.l.j.p.,
    please do not cross-post to three groups (in case you
    were wonderring if you might be that important - no,
    you are not).

    F'Ups set to c.l.js.

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
    Andrew Thompson, Jul 21, 2004
    #2
    1. Advertising

  3. Albretch

    Albretch Guest

    Andrew Thompson <> wrote in message news:<1hud2lju6r3x5$>...
    > Would you ask the baker about that problem
    > you are having with the roof on your house?


    Your parallelism I find more off-topic (and I would say stupid) than
    my inquiry.

    Proof?

    I did a javascript group:comp.lang.java.programmer search and got
    14,100 (including mine)

    '"public class" group:comp.lang.javascript' gives you 359
    '"public class" group:comp.lang.javascript -applet'; 108

    '"public class" group:comp.infosystems.www.authoring.html'; 12

    There must be a reason why javascript qs are more than 100% likely
    posted on a java group than java qs are posted in JS/design ones. I
    have constantly seen people asking HTML and Javascript questions to
    server side java developers here in this group.

    They usually complain about HTML/design people being cranky.

    > In future, please do not post JS questions to c.l.j.p.,
    > please do not cross-post to three groups (in case you
    > were wonderring if you might be that important - no,
    > you are not).
    >
    > F'Ups set to c.l.js.


    Thank you for letting me know how important I should think I am.

    Now, do you want to become my mother too?
    Albretch, Jul 22, 2004
    #3
  4. Albretch

    Brian Guest

    Albretch wrote:

    > I did a javascript group:comp.lang.java.programmer search


    Great. But Java != JavaScript.

    > There must be a reason why javascript qs are more than 100% likely
    > posted on a java group than java qs are posted in JS/design ones.


    There must be a reason why articles x-posted to more than one group
    are often not appropriate for any of them.

    > I have constantly seen people asking HTML and Javascript questions to
    > server side java developers here in this group.


    Java and JS questions are off-topic for ciwah, unless they pertain to
    the markup used to include them in an html document.

    > Now, do you want to become my mother too?


    Do you want to get plonked?

    --
    Brian (remove ".invalid" to email me)
    http://www.tsmchughs.com/
    Brian, Jul 22, 2004
    #4
  5. Albretch

    Murray Guest

    > Your parallelism I find more off-topic (and I would say stupid) than
    > my inquiry.


    Andrew's post was off-topic I guess *but you started it* :p He was simply
    pointing out your mistake, so that you/others wouldn't make the same mistake
    in the future. He could said it more succinctly and in a nicer way, but at
    least he got his point across ...

    >
    > Proof?
    >
    > I did a javascript group:comp.lang.java.programmer search and got
    > 14,100 (including mine)
    >
    > '"public class" group:comp.lang.javascript' gives you 359
    > '"public class" group:comp.lang.javascript -applet'; 108
    >
    > '"public class" group:comp.infosystems.www.authoring.html'; 12


    I did a "depression" group:sci.med.cardiology search and got 886 results.
    Then I did an "atherosclerosis" group:alt.support.depression.medication
    search and got 62 results

    I must remember from now on to post all depression related questions to
    sci.med.cardiology as well

    > There must be a reason why javascript qs are more than 100% likely
    > posted on a java group than java qs are posted in JS/design ones. I
    > have constantly seen people asking HTML and Javascript questions to
    > server side java developers here in this group.


    I'd take a guess that a large proportion of those would be
    - posts like yours
    - posts by newbies who don't realise the difference between Java and
    Javascript
    - posts containing the word Javascript but are not related to Javascript
    (e.g. posted JSP code that has js code in it)

    > Thank you for letting me know how important I should think I am.
    >
    > Now, do you want to become my mother too?


    Waah
    Murray, Jul 22, 2004
    #5
  6. Albretch

    Albretch Guest

    Brian <> wrote in message news:<>...
    > Albretch wrote:
    >
    > > I did a javascript group:comp.lang.java.programmer search

    >
    > Great. But Java != JavaScript.
    >


    Jeez! I new these guys would be able to even challenge Einsteins
    equation.

    They are so smart!!!

    > There must be a reason why articles x-posted to more than one group
    > are often not appropriate for any of them.
    >
    > > I have constantly seen people asking HTML and Javascript questions to
    > > server side java developers here in this group.

    >
    > Java and JS questions are off-topic for ciwah, unless they pertain to
    > the markup used to include them in an html document.
    >
    > > Now, do you want to become my mother too?

    >
    > Do you want to get plonked?


    Reinforcing exactly my point.

    Brian, you have really broken my heart, I could not sleep well
    because of your language.
    Albretch, Jul 22, 2004
    #6
  7. Albretch

    kaeli Guest

    In article <>,
    enlightened us with...
    > Hi,
    >
    > client wants for a window with no toolbars to open (technical and
    > 'esthetical' reasons) after the window, user clicks on, is being
    > closed.
    >
    > I told them about security settings in browsers and no cross-browsers
    > solutions and all of that we know, but they have told me they have
    > seen that before and how then the annoying pop-up windows work? . . .
    >


    They work in IE with no blocking software installed.
    My browser, Netscape 7, blocks all that shit. So do many others,
    including Firefox, Mozilla, and Opera.
    IE on the lowest security setting allows a popup to close the opener,
    IIRC.

    What the client wants sounds best suited to an intranet application
    where the users all have IE and can make the site "trusted". Is this the
    case? If not, don't bother. Most internet users do not want popups and
    none of them are going to trust your application to close the opener
    from a popup. The very concept of such a thing is alien for Opera users,
    since new "windows" are able to be opened in one browser instance.
    Trying to close the opener might well close the entire application.
    Now, if it IS an intranet application and the users have IE, try making
    the site trusted in the low security settings. That might make the
    message go away.

    HTH

    --
    --
    ~kaeli~
    Once you've seen one shopping center, you've seen a mall.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
    kaeli, Jul 22, 2004
    #7
  8. "Albretch" <> wrote in message
    news:...
    > Hi,
    >
    > client wants for a window with no toolbars to open (technical and
    > 'esthetical' reasons) after the window, user clicks on, is being
    > closed.
    >
    > I told them about security settings in browsers and no cross-browsers
    > solutions and all of that we know, but they have told me they have
    > seen that before and how then the annoying pop-up windows work? . . .


    If I have my browser open and I'm browsing to one site, and then I go to
    another, and then to another, and your client's site happens to be one of
    them, then who the hell does your client think he is closing MY browser on
    me and opening a different one without my normal configuration? Would your
    client like it if he came to my web site and suddenly found that all his
    icons had been removed from his desktop because I think a minimalist
    appearance is more esthetically pleasing? Tell him how I configure my
    software is my business and isn't subject to his esthetical sensibilities.
    Harlan Messinger, Jul 22, 2004
    #8
  9. Albretch

    Murray Guest

    "Albretch" <> wrote in message
    news:...

    > This is what I have (see below) which is still prompts you with the
    > message:
    >
    > "The Web page you are viewing is trying to close the window."
    >
    > "Do you want to close the window?"
    >
    > "[YES|NO]"


    Unfortunately, that's just what IE does if you try to close the *main*
    browser window. You can close any other window without prompting, but you
    will always be prompted if you try to close the main window (the very first
    window after opening IE). I looked into this quite a while ago, and there
    was no solution at the time, and I believe that is still the case.
    Murray, Jul 22, 2004
    #9
  10. "Murray" <> wrote in message
    news:40ffcf75$0$26896$...
    >
    > "Albretch" <> wrote in message
    > news:...
    >
    > > This is what I have (see below) which is still prompts you with the
    > > message:
    > >
    > > "The Web page you are viewing is trying to close the window."
    > >
    > > "Do you want to close the window?"
    > >
    > > "[YES|NO]"

    >
    > Unfortunately, that's just what IE does if you try to close the *main*
    > browser window. You can close any other window without prompting, but you
    > will always be prompted if you try to close the main window (the very

    first
    > window after opening IE). I looked into this quite a while ago, and there
    > was no solution at the time, and I believe that is still the case.


    And that's a good thing.
    Harlan Messinger, Jul 22, 2004
    #10
  11. Albretch

    Murray Guest

    "Harlan Messinger" <> wrote in message
    news:...
    >
    > "Murray" <> wrote in message
    > news:40ffcf75$0$26896$...
    > >
    > > "Albretch" <> wrote in message
    > > news:...
    > >
    > > > This is what I have (see below) which is still prompts you with the
    > > > message:
    > > >
    > > > "The Web page you are viewing is trying to close the window."
    > > >
    > > > "Do you want to close the window?"
    > > >
    > > > "[YES|NO]"

    > >
    > > Unfortunately, that's just what IE does if you try to close the *main*
    > > browser window. You can close any other window without prompting, but

    you
    > > will always be prompted if you try to close the main window (the very

    > first
    > > window after opening IE). I looked into this quite a while ago, and

    there
    > > was no solution at the time, and I believe that is still the case.

    >
    > And that's a good thing.


    Agreed :) It would have been nice to disable it for Intranet though, but it
    was no big deal
    Murray, Jul 22, 2004
    #11
  12. (Albretch) wrote in message news:<>...
    > client wants for a window with no toolbars to open (technical and
    > 'esthetical' reasons) after the window, user clicks on, is being
    > closed.


    And I want a Web page that will detect that the person reading it is
    the sort of jerk who wants to create pages that muck with my browser
    settings, and proceed to electrocute that user in order to take such
    antisocial tendencies out of the gene pool.

    But you can't always get what you want...

    --
    Dan
    Daniel R. Tobias, Jul 22, 2004
    #12
  13. Murray wrote:
    > Harlan Messinger wrote:
    >> Murray wrote:

    <snip>
    >>> ... . I looked into this quite a while
    >>> ago, and there was no solution at the
    >>> time, and I believe that is still the case.

    >>
    >> And that's a good thing.

    >
    > Agreed :) It would have been nice to disable
    > it for Intranet though, but it was no big deal


    There is a bug in current and past IE versions that allows it to be
    tricked into closing a window that was not opened with a script, without
    showing the dialog. But the technique is unlikely to be reiterated here
    (as it is harmful in an Internet context). If you want to know the
    unconditional truth you would have to search the comp.lang.javascript
    archives for it.

    Richard.
    Richard Cornford, Jul 22, 2004
    #13
  14. Albretch wrote:
    > Brian <> wrote in message news:<>...
    >> Albretch wrote:
    >>
    >> > I did a javascript group:comp.lang.java.programmer search

    >>
    >> Great. But Java != JavaScript.

    >
    > Jeez! I new these guys would be able to even challenge Einsteins
    > equation.
    >
    > They are so smart!!!


    While you cannot stop crossposting off-topic and replying
    using what is left of your brain, would you please FOAD?


    PointedEars, Score adjusted, F'up2 where it belongs
    Thomas 'PointedEars' Lahn, Jul 26, 2004
    #14
  15. Albretch

    Neal Guest

    On 22 Jul 2004 05:09:59 -0700, Albretch <> wrote:
    >
    > Brian, you have really broken my heart, I could not sleep well
    > because of your language.



    And thanks for playing. *plonk*
    Neal, Jul 26, 2004
    #15
  16. Albretch

    Albretch Guest

    > I did a "depression" group:sci.med.cardiology . . .

    Same old, same old.

    Hard to tell if you should laugh or cry with these HMTL/Javascript
    people, . . . they apparently not only challenge Einstein's equation
    (see above), but they have also some clues about 'semantic fields' of
    words and searching stuff

    Jeez, aren't these little smart a$$*$?

    Also, I think you have all misread my post in the eaiest possible
    way.

    I said, I will/need to:

    1) open an initial window via target="_new", which would then

    2) open a window from 1 which will not have toolbars and

    3) would close 1

    I wonder how/why would this change the world as we know it.
    Albretch, Jul 26, 2004
    #16
  17. Albretch wrote:

    > 1) open an initial window via target="_new", which would then
    >
    > 2) open a window from 1 which will not have toolbars and
    >
    > 3) would close 1


    Seems unnecessarily complex, even assuming for the sake of argument that
    the opening of new windows, and the use of windows without toolbars, are
    actually a good idea. Why not just open up the toolbar-less window in
    step 1, and avoid the need for the extra interim window that just gets
    closed anyway?

    --
    Dan
    Daniel R. Tobias, Jul 26, 2004
    #17
  18. Albretch

    Grant Wagner Guest

    Albretch wrote:

    > I said, I will/need to:
    >
    > 1) open an initial window via target="_new", which would then
    >
    > 2) open a window from 1 which will not have toolbars and
    >
    > 3) would close 1
    >
    > I wonder how/why would this change the world as we know it.


    _You_ may have the best intentions in the world, and _you_ may have the
    most pressing need in the world to do this. People's lives could be at
    stake if you can't do this.

    HOWEVER.

    If _you_ can do this uninvited then _anyone_ can do it uninvited, and I
    don't want Web sites doing this to *MY* Web browser running on *MY*
    computer.

    It would be like me saying "The gas meter reader needs to get in your
    house to read the gas meter. He's just coming to read the meter and he's
    perfectly honest, so the easiest thing to do would be to leave the door
    on your house unlocked all the time, I don't see how this would change
    the world as we know it."

    As you can see, leaving the door unlocked for the gas meter reader seems
    like a reasonable thing to do until you realize the world is filled with
    lots of people who would take advantage of your unlocked door.

    --
    Grant Wagner <>
    comp.lang.javascript FAQ - http://jibbering.com/faq
    Grant Wagner, Jul 29, 2004
    #18
  19. Albretch

    DU Guest

    Albretch wrote:


    >
    > I said, I will/need to:
    >


    Did you really need to post this to a java programming newsgroup? Has
    your post anything to do with java actually?

    > 1) open an initial window via target="_new",
    >


    target="_new" is already invalid markup code.
    "Except for the reserved names listed below, frame target names must
    begin with an alphabetic character (a-zA-Z). User agents should ignore
    all other target names."
    http://www.w3.org/TR/html401/types.html#type-frame-target

    > which would then


    You can not force this in NS 7.x and Mozilla-based browsers:
    user_pref("browser.block.target_new_window", true);

    Even HTML 4.01 Technical Recommendation clearly indicate that user
    agents can bypass and override target="_blank" calls:

    "User agents may provide users with a mechanism to override the target
    attribute."
    http://www.w3.org/TR/html401/present/frames.html#h-16.3.2

    > 2) open a window from 1 which will not have toolbars and
    >


    Automatically opening an unrequested window will be filtered, prevented,
    suppressed by a very wide majority of modern browsers nowadays:
    NS 7.x, MSIE 6 SP2, Opera 7.x, K-meleon 0.8+, Galeon 1.x, Konqueror 3.x,
    Safari 1.x, etc.. not to mention all kinds of 3rd parties add-ons,
    browser extensions, etc.

    You can not force Opera 7.x, Mozilla-based browsers to suppress
    toolbars: that is just impossible to force.

    user_pref("dom.disable_window_open_feature.toolbar", true);
    user_pref("dom.disable_window_open_feature.location", true);
    user_pref("dom.disable_window_open_feature.personalbar", true);
    user_pref("dom.disable_window_open_feature.menubar", true);
    user_pref("dom.disable_window_open_feature.scrollbars", true);
    user_pref("dom.disable_window_open_feature.resizable", true);
    user_pref("dom.disable_window_open_feature.minimizable", true);
    user_pref("dom.disable_window_open_feature.status", true);


    Since windows XP SP2 release, web developers can not remove by force
    statusbar from new secondary windows.

    > 3) would close 1
    >


    You can't even force that in Mozilla-based browsers either:
    user_pref("dom.allow_scripts_to_close_windows", true);

    while there are bugs filed for forcing scripts closing windows with a
    cheap js window.opener trick in MSIE 7 and Opera 7: security is now
    important you see.


    > I wonder how/why would this change the world as we know it.


    Removing statusbar is removing the toolbar by which users can see http
    connections, transfers, loading notifications, security (SSL) padlock
    icon status: why would you (or your clients) need to remove such toolbar
    from the users' browsers? Did you know that some security hacks were
    successful because users could not see the difference (different urls)
    between what was written in the statusbar and what was in the
    locationbar? So, why would you (or your clients) want to remove both the
    statusbar and locationbar on the users' browsers?

    Why would leaving these toolbars present change anything for your own
    security, your own personal info, your own sensitive info? If you or
    your clients can not understand the users' perspective, then just put
    and leave your credit card numbers, personal identifications, phone
    numbers, etc.. on a webpage for a few days.

    DU
    --
    The site said to use Internet Explorer 5 or better... so I switched to
    Mozilla 1.7.3 :)
    DU, Sep 29, 2004
    #19
    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. net
    Replies:
    0
    Views:
    428
  2. Pokey
    Replies:
    9
    Views:
    707
    Adrienne
    Jun 8, 2004
  3. James M. Haberman

    Open new browser window with no toolbars

    James M. Haberman, Jan 10, 2005, in forum: HTML
    Replies:
    5
    Views:
    905
    Mark Parnell
    Jan 10, 2005
  4. Uriah Piddle

    Opening new browser window without toolbars

    Uriah Piddle, Nov 10, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    647
    Uriah Piddle
    Nov 10, 2006
  5. Replies:
    1
    Views:
    98
    Peter Michaux
    Sep 26, 2007
Loading...

Share This Page