Good morning / afternoon / evening and season's greetings to you all.
It all seems to work ok, but the window.close function activates a pop-up prompt (i'm sure you know the one: "The web page you are viewing is trying to close the window"). I realise the importance of this prompt for security reasons but is there any way round it using a slightly modified script?
If anyone knows a way in PHP, this will be just as good.
Thanks in advance for any help anyone can give! ;-)
Hi, and season's greetings to you too :)
The security message you just mentioned (this browser is trying to close this window) is an in-built feature of the browser, so no amount of programming will get you around it. It's pre-dominantly a security measure to protect 'innocent' surfers against malicious coders.
That msg actually doesn't appear in older browsers, but it's a standard thing from version 4.x onwards.
So in other words, you'd have to break open the browser code to get rid of it :D
Hope this helps.
Nah. It works fine with a minor change:
Errr.... That's the same as above. Still get the 'trying to close this window' error. (on IE)
Works in Netscape though ;)
<Edited by BC on 12-13-2000 at 07:02 PM>
<a href="" onclick="self.close">Close this Window</a>
and it works with no prompt.
Funny it works on one of my sites with no problem. See http://www.pbbt.com/ (only first visit... cookie prevents repeat popups.) Maybe it doesn't complain if the window is opened by java script in the first place (as I think someone already said)...
Very interesting... I should have a better look at this later on...
actually i've been on somewebsite that dont ask me with ie5 but with the same pc on ie5 some pages do ask me....
i was kind of about to ask the same...
If the window was originally opened by a script from the same server as the document currently loaded in the window, then there will be no prompt. Basically, the browser trusts a single site to open and close windows as it wishes, but for one site to open a window and then a different site to close it, the browser prefers to be safe and make sure the user agrees with that action.
Although this will work fine in Netscape browsers and on IE for the Mac, I have never, ever been able to make it work on IE/Windows without the alert when the parent window tries to close itself.
If someone can show me a working example of this, I'd love to see it.
What do you mean by "when the parent window tries to close itself"?
As Kevin says, you will only get such a msg, if the page to close was not opened by some script on the same server as the page giving the self.close() command.