JavaScript and client side scripting.
Moderator: General Moderators
raghavan20
DevNet Resident
Posts: 1451 Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:
Post
by raghavan20 » Fri Oct 14, 2005 5:30 am
This does not work in Mozilla but works in IE.
any suggestions to make it work in mozilla.
Code: Select all
<p align="center">Click here to <a href="javascript:self.close();">close</a> this window</p>
Last edited by
raghavan20 on Sat Oct 15, 2005 6:50 pm, edited 1 time in total.
foobar
Forum Regular
Posts: 613 Joined: Wed Sep 28, 2005 10:08 am
Post
by foobar » Fri Oct 14, 2005 6:25 am
try window.close(); instead.
raghavan20
DevNet Resident
Posts: 1451 Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:
Post
by raghavan20 » Sat Oct 15, 2005 5:57 pm
thanks foobar, i also saw the same in Mozilla site...
but for some reason it does not work in my Mozilla browser
Code: Select all
<a href = "" onclick = "javascript:window.close();">close me </a><br />
<a href = "javascript:window.close();">close me </a>
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Oct 15, 2005 6:05 pm
you don't need to specify javascript in the onclick
raghavan20
DevNet Resident
Posts: 1451 Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:
Post
by raghavan20 » Sat Oct 15, 2005 6:22 pm
This does not work again.
Javascript is enabled in Mozilla...i jus checked it now...
Code: Select all
<a href = "#" onclick = "window.close();">close me </a>
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Oct 15, 2005 6:34 pm
if the window wasn't opened via javascript, Mozilla may not let you close it. That's the behaviour in 1.5 Beta 1 and Beta 2 anyways..
raghavan20
DevNet Resident
Posts: 1451 Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:
Post
by raghavan20 » Sat Oct 15, 2005 6:49 pm
thanks for the answer feyd, i tried it...it works as u say??
I dont really know why they chose to do it that way.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Oct 15, 2005 6:57 pm
because javascript shouldn't be able to close a window it did not create... that's not all that hard to understand..
raghavan20
DevNet Resident
Posts: 1451 Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:
Post
by raghavan20 » Sat Oct 15, 2005 7:03 pm
I understand that...but why dont the mozilla allow when IE allows.
Cos in many situations during redirection, we might need this property to work.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Oct 15, 2005 7:06 pm
Redirection stays in the window, why close it? IE has incorrect implementations of many parts of the standards, along with poor ideas of security..
raghavan20
DevNet Resident
Posts: 1451 Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:
Post
by raghavan20 » Sat Oct 15, 2005 7:13 pm
sometimes i feel it better...
ex:
you purchase a few items...check out using paypal...paypal directs bk to your site...you display thanks message...the dialogue ends there...it wld be nice if we offer the viewer, the link to close the current window.