SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Close Initial Site Window

    Suppose in your index.html file that you open another window (without toolbars) as the main window for your site, and then naturally you want to close the first window (index.html) since its purpose is only to open your main window.

    When I call self.close() from index.html, I get a prompt from IE saying that the window is trying to close itself. Is there a way to avoid this or do I have to keep that first window open?

    Here's the script

    <script type="text/javascript">
    window.open("main.php", "wdoMain", "resizable, scrollbars, status");
    self.close();
    </script>

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    You can't close the browser window on your users without getting that popup message in any browser I've tested it on.

    Another deeper question is, why would you go and close the browser window haphazardly on your users? They may need that "back" button you know, your site may not be their homepage. It's generally bad practice to try and close this window and I'm wondering why the lack of toolbars is so necessary. Any halfway savvy user will be able to use the keyboard shortcuts to do what they want such as open a location with ctrl+L. Also, once that's open, they can type javascript: commands to put toolbars and resizing back on the window. I'd suggest finding another method of accomplising your goal without ticking off your users.

    --Vinnie


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •