New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

How To Close Window in safari for Mac Os


Post Reply New Thread Subscribe

 
Thread Tools
mohan.reddy

 
Member Since: Jul 19, 2010
Posts: 1
mohan.reddy is on a distinguished road

mohan.reddy is offline
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
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,107
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks
eddielee

 
eddielee's Avatar
 
Member Since: Sep 19, 2008
Location: Nottingham, UK
Posts: 302
eddielee is on a distinguished road
Mac Specs: 20" iM ac,13.3" Aluminium Unibody Macbook, iPhone 4

eddielee is offline
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
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,107
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks
eddielee

 
eddielee's Avatar
 
Member Since: Sep 19, 2008
Location: Nottingham, UK
Posts: 302
eddielee is on a distinguished road
Mac Specs: 20" iM ac,13.3" Aluminium Unibody Macbook, iPhone 4

eddielee is offline
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
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,107
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks

Post Reply New Thread Subscribe


« Can I recover deleted photos | Adding /usr/local/bin to PATH »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Safari Download Window Autoclose? Marino OS X - Apps and Games 1 06-11-2010 07:18 PM
Sometimes it won't let me close a window till i drag it then try again? Tyler Gostynski OS X - Operating System 0 02-18-2010 06:21 PM
Maximizing the Safari Window Jaygray OS X - Apps and Games 0 10-26-2008 01:10 PM
Safari: new tab instead of new window? smurfy OS X - Apps and Games 5 07-25-2007 01:20 PM
safari Window won't close jeje13 OS X - Operating System 3 01-01-2007 11:54 AM

All times are GMT -4. The time now is 11:51 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?