Forum Moderators: phranque

Message Too Old, No Replies

window.close() on MAC

button works on all platforns and browsers except IE on a Mac

         

briandangbob

8:16 pm on Jun 24, 2003 (gmt 0)

10+ Year Member



<area shape="rect" coords="1,0,68,20" href="javascript:window.close()" target="_top" alt="">

that is my code please review. a window will pop up with a close button in the upper left. the page uses frames. _top is the target of the action.the window closes in everything but IE on the Mac.
why?

[edited by: briandangbob at 8:42 pm (utc) on June 24, 2003]

BlobFisk

8:39 pm on Jun 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi briandangbob,

I wonder if this has something to do with the target="_top"? Is this there for a specific reason? If not, try removing it and see if it makes a difference.

Also, personal URL drops are against the TOS [webmasterworld.com]. You should consider taking it out or wait for a mod to do it!

briandangbob

8:50 pm on Jun 24, 2003 (gmt 0)

10+ Year Member



thanks for responding

yes _top is there for a reason. the page uses forms _top is the target of the action. with out it, it would not close anything. as you may know _top refers to the outermost frameset of the current doc. i have tried all sorts of targets no targets ect... nothing seems to work in IE on a Mac. I am stumped.

BlobFisk

8:52 pm on Jun 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmmm... have you tried self.close() instead of window.close()?

broniusm

8:56 pm on Jun 24, 2003 (gmt 0)

10+ Year Member



brianetal,

consider javascript:_top.close(); (without the target)

(untried & unproven, if it works, it would be smooth, then)

briandangbob

9:00 pm on Jun 24, 2003 (gmt 0)

10+ Year Member



yes I have tried self.close(), with and with out a target. all though I know it needs a target. if I change it to self.close() and keep the target as _top I get the same results. works everywhere but IE on a Mac. strange

BlobFisk

9:04 pm on Jun 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




the page uses forms _top is the target of the action. with out it, it would not close anything. as you may know _top refers to the outermost frameset of the current doc.

Do you mind if we revisit this? Your page has a form on it? But, clicking on the close button does nothing to the form. It merely closes the window - no form submission takes place unless explicitly stated (by document.form.submit).

You say that without it it would not close anything? Why so? I'm assuming that the page containing the close button code is part of a frameset. Ok, then using window.close() should work - it tells the page to close the entire window. Or, you could use document.parent.close() - telling the document to close it's parent: the frameset.

_top is an html target attribute and not a JavaScript one. I think you should look at the window or parent option and remove the target="_top".

HTH

briandangbob

9:09 pm on Jun 24, 2003 (gmt 0)

10+ Year Member



bingo broniusm wins-

top.close() works just how I want. BlobFisk it is frames we are talking about not forms. I wanted to close a browser window containing a website with frames incorporated in it. you guys rock beers for everybody.

BlobFisk

9:14 pm on Jun 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My bad - long day! Good catch broniusm!