/    Sign up×
Community /Pin to ProfileBookmark

The web page you are viewing is trying to close the window

I have a window that’s opened via a hyperlink from a parent window.

If I try to close this “child” window with a simple self.close(), I get the prompt:

The web page you are viewing is trying to close the window

Here’s my HEAD code:
<SCRIPT language=”VBScript”>
Sub Window_Onload
window.opener = “x”
End Sub
</SCRIPT>

In my BODY, I’ve got:
<INPUT type=”button” value=”Close Form”
onclick=”self.close();” >

How can I get this prompt to go away?

Thanks!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisJan 17.2007 — You can't. It is a browser security measure. Basically, if you did not open the window using javascript, you can't close it using javascript.

If you can figure out how to open the window using javascript and not by the hyperlink, you can avoid the message (assuming the page is on the same domain).
Copy linkTweet thisAlerts:
@A1ien51Jan 17.2007 — Also why VBScript?

Eric
Copy linkTweet thisAlerts:
@felgallJan 17.2007 — Obviously using VBscript because they only want the code to run in Internet Explorer and not in any other web browsers.
×

Success!

Help @bubberz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...