Results 1 to 6 of 6
  1. #1
    How To Close Window in safari for Mac Os

    Member Since
    Jul 19, 2010
    Posts
    1
    Post How To Close Window in safari for Mac Os
    Hi............
    The problem is using Safari in Mac Oprating System.I am unable to Close Window using java script window.close() or self.close().I'm using the following code line, which is working fine with all browser of Window OS.

    <script type="text/javascript">
    <!--
    self.focus();
    setTimeout("self.close();",1);
    //-->
    </script>

    and

    <a href="javascript:window.close();">Close this window</a></span>

    Any help most appreciated.

    Mohan Reddy

  2. #2
    How To Close Window in safari for Mac Os
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    You can only close a window with JS if you opened it with JS. How are you opening the window?

    See the following:
    http://www.velocityreviews.com/forum...mac-close.html
    http://forums.macosxhints.com/showthread.php?t=56352

    EDIT: Apparently, I am wrong. Just tried it here and it works with some browsers (Opera and Safari) but not others (Chromium). Will get back to you.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  3. #3
    How To Close Window in safari for Mac Os
    eddielee's Avatar
    Member Since
    Sep 19, 2008
    Location
    Nottingham, UK
    Posts
    302
    Specs:
    20" iM ac,13.3" Aluminium Unibody Macbook, iPhone 4
    Vansmith, as far as I am aware you are correct. That is what I have always been told, but some browsers ignore this and it does work.
    Thanks, Eddie
    Software Engineering Student, NTU

  4. #4
    How To Close Window in safari for Mac Os
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    I'm not at my Mac right now so you'll have to test this yourself with other browsers. I only say that you'll have to test this because it works fine for me in Safari here (Windows) while it doesn't for you. Does this work in other browsers?
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  5. #5
    How To Close Window in safari for Mac Os
    eddielee's Avatar
    Member Since
    Sep 19, 2008
    Location
    Nottingham, UK
    Posts
    302
    Specs:
    20" iM ac,13.3" Aluminium Unibody Macbook, iPhone 4
    On my mac:

    Chrome, dosnt work
    Firefox, dosnt work
    Safari 4, dosnt work
    Safari 5, DOES work

    You CAN close a FireFox window/tab even if your script didn't open it Try this.
    Thanks, Eddie
    Software Engineering Student, NTU

  6. #6
    How To Close Window in safari for Mac Os
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Works in Opera 10.70 (dev build) on Windows. Mohan, do you have any source we can take a look at? It would make solving this much easier.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can't get a window to close in mail
    By 323trent in forum OS X - Operating System
    Replies: 3
    Last Post: 05-05-2015, 05:50 AM
  2. How do I close individual window
    By John S in forum Switcher Hangout
    Replies: 3
    Last Post: 08-10-2012, 01:09 PM
  3. Weird "Untitled Download" in Safari, Safari won't close, Mac stops
    By CriminalReborn in forum OS X - Operating System
    Replies: 0
    Last Post: 11-09-2011, 02:36 PM
  4. safari Window won't close
    By jeje13 in forum OS X - Operating System
    Replies: 3
    Last Post: 01-01-2007, 11:54 AM
  5. Close Window Transitions
    By DrQuincy in forum Switcher Hangout
    Replies: 6
    Last Post: 11-14-2006, 09:11 PM

Posting Permissions

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