I want to close a browser window so I created a Close button that does this:
private void Button1_Click(object sender, System.EventArgs e)
{
RegisterClientScriptBlock("GetData","<Script>close ()</Script>");
}
But when this runs the browser puts up a dialog box saying: "The web page
you are viewing is trying to close the window, od you want to close this
window?"
Is there a way to close a browser window without this dialog box? 4 6307
HI Ron,
No, there is no way of doing this. The only windows you can close with any
notification are the windows that your browser create.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Ron Lautmann" <ro*******************@pacbell.net> wrote in message
news:el**************@tk2msftngp13.phx.gbl... I want to close a browser window so I created a Close button that does
this: private void Button1_Click(object sender, System.EventArgs e) { RegisterClientScriptBlock("GetData","<Script>close ()</Script>"); }
But when this runs the browser puts up a dialog box saying: "The web page you are viewing is trying to close the window, od you want to close this window?"
Is there a way to close a browser window without this dialog box?
> No, there is no way of doing this. The only windows you can close with
any notification are the windows that your browser create.
Not true! The window.close() method checks to see if the opener property of
the window is null (meaning that it was not spawned by another browser
window). If you set the opener property to the window itself, it closes
without a prompt:
window.opener = self;
window.close();
Try it!
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uG**************@TK2MSFTNGP09.phx.gbl... HI Ron,
No, there is no way of doing this. The only windows you can close with
any notification are the windows that your browser create.
Cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Ron Lautmann" <ro*******************@pacbell.net> wrote in message news:el**************@tk2msftngp13.phx.gbl... I want to close a browser window so I created a Close button that does this: private void Button1_Click(object sender, System.EventArgs e) { RegisterClientScriptBlock("GetData","<Script>close ()</Script>"); }
But when this runs the browser puts up a dialog box saying: "The web
page you are viewing is trying to close the window, od you want to close this window?"
Is there a way to close a browser window without this dialog box?
That solution works well! Thanks for the info.
Ron Lautmann
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Ol**************@TK2MSFTNGP09.phx.gbl... No, there is no way of doing this. The only windows you can close with any notification are the windows that your browser create.
Not true! The window.close() method checks to see if the opener property
of the window is null (meaning that it was not spawned by another browser window). If you set the opener property to the window itself, it closes without a prompt:
window.opener = self; window.close();
Try it!
-- HTH, Kevin Spencer .Net Developer Microsoft MVP Big things are made up of lots of little things.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:uG**************@TK2MSFTNGP09.phx.gbl... HI Ron,
No, there is no way of doing this. The only windows you can close with any notification are the windows that your browser create.
Cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Ron Lautmann" <ro*******************@pacbell.net> wrote in message news:el**************@tk2msftngp13.phx.gbl... I want to close a browser window so I created a Close button that does this: private void Button1_Click(object sender, System.EventArgs e) { RegisterClientScriptBlock("GetData","<Script>close ()</Script>"); }
But when this runs the browser puts up a dialog box saying: "The web page you are viewing is trying to close the window, od you want to close
this window?"
Is there a way to close a browser window without this dialog box?
Hi Kevin,
Thanks for the tips, I had never imagined that, I think this is something
MS needs to change, it allow a rogue page to close my browser without a
warning.
I had always thought it was not possible
Thank again,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Ol**************@TK2MSFTNGP09.phx.gbl... No, there is no way of doing this. The only windows you can close with any notification are the windows that your browser create.
Not true! The window.close() method checks to see if the opener property
of the window is null (meaning that it was not spawned by another browser window). If you set the opener property to the window itself, it closes without a prompt:
window.opener = self; window.close();
Try it!
-- HTH, Kevin Spencer .Net Developer Microsoft MVP Big things are made up of lots of little things.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:uG**************@TK2MSFTNGP09.phx.gbl... HI Ron,
No, there is no way of doing this. The only windows you can close with any notification are the windows that your browser create.
Cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Ron Lautmann" <ro*******************@pacbell.net> wrote in message news:el**************@tk2msftngp13.phx.gbl... I want to close a browser window so I created a Close button that does this: private void Button1_Click(object sender, System.EventArgs e) { RegisterClientScriptBlock("GetData","<Script>close ()</Script>"); }
But when this runs the browser puts up a dialog box saying: "The web page you are viewing is trying to close the window, od you want to close
this window?"
Is there a way to close a browser window without this dialog box?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: marcelf3 |
last post by:
Hello..
This page opens a window with some information, but everytime the user
changes a field in the parent window, the child window needs to be
closed.
These 2 functions were supposed to do the...
|
by: Reggie |
last post by:
Hi and TIA! I have a form and have set the Close Button to false so that
users must exit using my close button. However when I open a Report from
this form I want the close button to be available...
|
by: Bert Szoghy |
last post by:
Hello,
I am missing something about Visual Basic .NET module variables and window
close events.
In the following code, after opening Form2 by clicking a button on Form1 and
then closing...
|
by: rdemyan via AccessMonster.com |
last post by:
I need help with code to close two forms at the same time, FormA and FormB. I
need code that can be used from either form and needs to work with both a
'Close' button on each form as well as if the...
|
by: polocar |
last post by:
Hi,
I would like to find a way in C# so that, when the user presses the
"Esc" key, the form closes; the problem is that I have a lot of
controls in the form.
At the beginning I have tried with...
|
by: mhifd009 |
last post by:
I have disabled a close button in the property section of a form (FRM1), as i open the form the close button has gone (i have programmed close button), but as i close the form, the form that opened...
|
by: kev |
last post by:
Hi folks,
I have a form for registration (frmRegistration) whereby i have two
buttons. One is Save which saves record using the OnClick property. I
used wizard to create the save button. The...
|
by: Del |
last post by:
I have a popup form that consist of a single field called EnteredBy
and a Subform that has three fields. The popup form also has a button
in the Form Footer called close. In the On Click event I...
|
by: Bruce |
last post by:
Hello,
I have a form in an Access 2003 application which opens maximized.
Its CloseButton property is set to false. On this form I have a
command button that opens a report in preview mode. ...
|
by: Sin Jeong-hun |
last post by:
I have a dialog form which pops up from the main window using the
ShowDialog() method. this dialog has no or button, and
it has quite a lot of controls on it. Now, I want to close this dialog...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |