/    Sign up×
Community /Pin to ProfileBookmark

closing a window

Does anyone know how to close a window without IE telling you that the page is trying to close itself and you having to click yes?

the goal is to load a page of a certain size with no control/toolbars from the outset. i was trying it by having a page open the new window like i want it with onLoad=”window.open(blah blah)” then closing itself using self.close(). it causes a prompt that i dont want. if im doing this the hard way another solution would be appreciated too!!

much thanks

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Dan_DrillichJan 14.2003 — Based on http://hotwired.lycos.com/webmonkey/98/03/index3a_page8.html# please try -

<i>
</i>
&lt;html&gt;&lt;head&gt;&lt;title&gt;Getting and using a window reference&lt;/title&gt;
&lt;script language="JavaScript"&gt;
&lt;!-- hide me

// open a new window and get a reference to it
var new_window = window.open("http://www.iwon.com","html_name","width=200,height=200");


// show me --&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;h1&gt;A new window has been opened and moved to the background.&lt;/h1&gt;
&lt;a href="#" onMouseOver="new_window.focus();"&gt;Bring it forward&lt;/a&gt;&lt;br&gt;
&lt;a href="#" onMouseOver="new_window.close();"&gt;Close it&lt;/a&gt;&lt;br&gt;


&lt;/body&gt;
&lt;/html&gt;


Cheers,

Dan
Copy linkTweet thisAlerts:
@gil_davisJan 14.2003 — That message is a security feature. It indicates that you are trying to close a window that was not opened using the javascript "window.open()" method. The message cannot be avoided in that case. Sorry.
Copy linkTweet thisAlerts:
@stewieauthorJan 14.2003 — thanks for the tips so far. super helpful
×

Success!

Help @stewie 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 5.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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...