473,480 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Closing a main window

2 New Member
Okay what I need to do is close a window when a viewer selects the cancel button a confirm box. The thing is that the box appears before the page loads, so its not a link.

How can i do this without windows IE asking if I want to close the page?
Sep 14 '07 #1
4 982
pbmods
5,821 Recognized Expert Expert
Heya, Newprog. Welcome to TSDN!

You can only close windows that you originally opened in your script using the window.open() function. If you try to close any other window, IE asks the User to allow it because the browser has no way of knowing if this action is intended to be malicious.
Sep 14 '07 #2
newprog2
2 New Member
Not so. By convincing IE that the main window was opened with javascript it will not ask to be closed, it just will.

the code is:
Expand|Select|Wrap|Line Numbers
  1. < a href="javascript:window.opener='x';window.close();">Close< /a>
Sep 14 '07 #3
pbmods
5,821 Recognized Expert Expert
Heya, NewProg.

Is that working for you?
Sep 14 '07 #4
mrhoo
428 Contributor
the window.opener='bob' trick doesn't work in IE7, unless you lower the security settings from their defaults. It never worked in the gecko browsers.
Sep 14 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2433
by: MJEASSOC | last post by:
I need some help with closing a popup window. I'm making an online portfolio, that has one base page with text and thumbnails. When a user clicks on a thumb, a new window opens containing a larger...
7
4498
by: Miktor | last post by:
At the minute I am using the following rather unwieldy function to prevent the console window in Dev C++ from closing before I can see the output from my program: // function to prevent the...
1
5795
by: Chris Bruce | last post by:
In my application I need a way to distiguish between the following events: 1. When a user closes an MDI child window. 2. When the user closes the MDI parent window which subsequently closes the...
6
3213
by: Gary Miller | last post by:
Does anyone know how to detect a modeless form on closing by the form that invoked the modeless form? form.Show();
1
2187
by: RJN | last post by:
Hi I open a few pop-up windows from a main window. If session time out occurs in either the main window or the pop-up windows ,I redirect the user to login screen. Currently what is happening is...
10
3980
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
6
1657
by: **Developer** | last post by:
I've been looking but can't find out how in a form Closing event to know if the closing is because the form's "X" had been clicked or the main form's "X" was clicked. That is, I need to know if...
8
1467
by: cj | last post by:
I know how to write code to find, kill and closeMainWindow on all processes but I really don't want to do that. I want work with applications not processes. As you know there are a lot more...
0
6904
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...
0
7076
jinu1996
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...
1
6732
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...
0
6886
tracyyun
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...
0
5324
agi2029
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,...
0
4472
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2990
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
174
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.