Randy Webb wrote:
Grant Wagner wrote: Arun Seetharam wrote:
<--snip-->
Works perfectly well with IE. But not with Netscape. The Javascript
console says 'Script may not close windows that were not opened by the
script'. Is there any workaround to this?
No, there is no workaround. And if the Microsoft folks were doing their
job,
And the people at OmniWeb, Opera and all the other non-Mozilla based
browsers where it works were doing their job.............
I'm not sure what your point is. If it's that the authors of the browsers
mentioned above have a bug in their software by allowing this behaviour, I
agree.
Presumably you are mentioning the other browsers to demonstrate that it is a
"feature" and not a "bug". However, if it were a "feature", then:
window.close();
would just *work* without a prompt. You would not have to resort to:
window.opener = window; window.close();
to get it to do what you want. The fact that you have to "fool" the browser
into having a valid value assigned to the "window.opener" property
demonstrates that it is a bug.
After all, what is the point of including code that stops you from executing
window.close(); if there is a way to avoid the warning? Why not introduce a
proprietary feature like window.close(true); to suppress the warning? Such
functionality would break no existing code and allow Microsoft to make it's
"feature" available in a way that doesn't involve what is obviously a hack.
When I reported the problem to Microsoft as a security vulnerability, I
received a very polite reply that basically Microsoft acknowledges that it is
a bug, but does not regard it as a "security" problem, because the user can
simply re-open the closed window. I guess they can't be bothered spending
some of that $60 billion cash surplus on fixing this.
Anyway, I look forward to the day some security patch or other breaks the
above code, and we are flooded with "... this used to work, what can I do
now?" type posts. I won't even try to avoid saying "I told you so", I'll just
laugh. Of course, most of these people shouldn't be trying to open new
windows in the first place given the current state of new window hatred, but
that's an argument for another time.
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq