Closing a web Page

M

Mariame

Hi Everyone
im trying to close a window using "window.close()"
but it send a message dialog before closing the web page says :
"The Web Page you are viewing is trying to close the window, do you want it
to close this window?"
is there any solutions so that message dialog doesent appear & the web page
close immediatly???
Regards
 
E

Ersin Gençtürk

if you want to close a window using this method , you have to open it before
using window.open
otherwise you will get this message.In other words , you can only close
child windows that you have opened.

for example try this :

window.open("1.htm");


in 1.htm write this :

window.close();
 
M

Mark Rae

Hi Everyone
im trying to close a window using "window.close()"
but it send a message dialog before closing the web page says :
"The Web Page you are viewing is trying to close the window, do you want it
to close this window?"
is there any solutions so that message dialog doesent appear & the web page
close immediatly???

Try this:

"window.opener=null;window.close();"
 
M

Mariame

Thx for ur reply
i want to close the main page & it wasnt open using "window.open()"
and there isnt another opened windows.
is there is another way to close the window using asp.net instead of using
scripts????
Thx & Regards
 
S

Shiva

Hi,

Any user-opened window will show that prompt (and cannot suppress it). Only
script-opened (window.open) windows will close silently.

Hi Everyone
im trying to close a window using "window.close()"
but it send a message dialog before closing the web page says :
"The Web Page you are viewing is trying to close the window, do you want it
to close this window?"
is there any solutions so that message dialog doesent appear & the web page
close immediatly???
Regards
 
M

Mr. Dot Net

It's a security feature that unables script to close a window he did not
open.

There are some walkarounds but you will have to give me first some more
details on the application:
When you close this window are there any other windows opened?
 
R

Raterus

no, here are the only ways I know of

use javascript to automate it..or
user clicks "close" in browser window.
user unplugs computer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top