window close ?

J

Jarod

Hey
Is there any way to asp.net generate window.close() - javascript function ?
I need to close user window if he doesn't have access to the page.
Jarod
 
E

Eliyahu Goldin

Sure, Response.Write("<script>window.close()</script>");

Note, that if the program is trying to close the main window, as opposed to
other windows opened from the main one, the browser will ask the user for
confirmation.

Eliyahu
 
M

Mark Rae

Sure, Response.Write("<script>window.close()</script>");

Note, that if the program is trying to close the main window, as opposed
to other windows opened from the main one, the browser will ask the user
for confirmation.

Response.Write("<script>window.opener=null;window.close();</script>");
 
Joined
Jul 8, 2009
Messages
1
Reaction score
0
Eh, you realize that doesn't work, right?

That code will give you a "Compiler Error Message: CS1010: Newline in constant" error.

Also, this can be viewed as a security issue - XXS, I believe.
 

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

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top