SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot asterikx's Avatar
    Join Date
    May 2002
    Location
    Montana
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple Question... JavaScript Window Close

    I'm still trying to learn JavaScript... Would anyone be willing to send over the tag that directs a link to close the current window?

    Thanks...

    -- asterikx

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The syntax goes something like:
    Code:
    javascript:close(window);
    Just apply that to a link or whatever you need to close the window.

    For a practical example, type that into your browser URL bar. I did that a moment ago to test it out. Works like a charm.

    -Colin
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Javascript can only close a window to whose reference handle it owns - in a way...
    So if the window was opened by JS then JS can close it without prompting - otherwise the browser will prompt
    and ask you if you want to close the browser or not.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---


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
  •