SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can you use javascript to close a window?

    I want to make it so when a user visits a page, the window just closes. (it's for a script i'm working on). But i'm unsure of the javascript. So basically, I don't want any popups, confirmation messages, or anything. Simple a user enters the url in his webbrowser, and upon arrival, BAM! the window closes.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    The javascript will be "self.close();", but if it's the primary window being opened your user will get a warning, letting him/her know that your script is trying to close the browser down. As long as you don't use this on the user's primary browser window you shouldn't have a problem (i.e. on popups).

  3. #3
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I want it to close the window regardless of what it is...is that possible in any way if not js?

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Nope, and it's a gross misuse of scripting. I highly recommend NOT doing this. Don't be a script kiddie!

  5. #5
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ohh . I'm not being a script kiddie...I'm just making a hack for vBulletin (the software this forum uses), which tortures banned users! It will keep closing the window on them and eventually they will just leave the forum alone!

    Is there no possible way of doing this at all whatsoever?!

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Why not just redirect them to a certain very nasty site! Hint, starts with goat...

  7. #7
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah but with redirects they can just stop the page...

  8. #8
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    If someone's determined enough they'll still try and find a way into your site. Even if you block IPs, most people are on DHCP setups and will get a new address every so often. Your best bet is a redirect. If they're banned anyway they'll get the message when they haven't been able to get in for a few weeks.

  9. #9
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I guess there's no way even outside of javascript to close a window?

  10. #10
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by vgarcia
    The javascript will be "self.close();", but if it's the primary window being opened your user will get a warning...
    Fwiw, that warning can be bypassed quite simply (on javascript enabled browser).
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  11. #11
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Bill Posters


    Fwiw, that warning can be bypassed quite simply (on javascript enabled browser).
    do you know how or where I can find out how?

  12. #12
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by N9ne
    So I guess there's no way even outside of javascript to close a window?
    Of course there is and it's so simple! (Windows/Linux) Just move the mouse over to the "x" on the upper right corner of the browser and click it. (OSX) It's the red button on the upper left corner of the browser. Click there.


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
  •