We help IT Professionals succeed at work.

How do i force the window.close without getting the MsgBox

gel
gel asked
on
im running an html page from my desktop i call window.open onload & i want to close the original browser with window.close . when i do that i get a confirmation message from the browser.

how do i make the message not to appear?
since the browser was not opened with script there is security problem which i need to overcome !!
Comment
Watch Question

BRONZE EXPERT
Commented:
Only windows that are opened using a window.open script statement will not give you the msgbox when window.close is encountered.


That's all I have to say and I believe everyone will have the same views are me.


hongjun

Commented:
You can only use the window.close() method on windows that were themselves opened using the window.open() method.

If the parent window already existed...maybe due to browsing around or you typed the address in the address bar...then you won't be able to close it automatically without a browser alert message.

Commented:
that i know , what i dont know is how to go round it if possible.

Commented:
Not unless it was opened using window.open() ... not even if you opened it using pure HTML.

Commented:
why cant i accept the answer?
BRONZE EXPERT

Commented:
???
Try again perhaps.
BRONZE EXPERT

Commented:
Or perhaps I get help from one of the moderators.

hongjun

Commented:
Could it be that the question is resistered under username "gel" and you are commenting under username "etay"? You need to be logged in as "gel".
window.Close method will only close windows created using the open() method;
If yoiu attept to close a window not created using open(), the user
will be prompted to confirm this action with a dialog box before closing.
   Important: the single exception to this is if the current active window has only
one document in its session history. In this case the closing of the window
will not require confirmation.
gel,
can you shed some light on this.  Do you have 2 accounts.  I will afford you the opportunity to let me resolve this the friendly way.  I see that the gel account was registered 11/3 (yesterday).  The etay account has been registered for a while.  I will give you a day to respond to this.

Thank you
Computer101
Community Support Moderator
gel

Author

Commented:
no two people r using the same computer

Explore More ContentExplore courses, solutions, and other research materials related to this topic.