Forum Moderators: open

Message Too Old, No Replies

How do I trap File-->New -->Window event.

         

jsphtml

1:59 am on Dec 26, 2004 (gmt 0)

10+ Year Member



Hi I have a related thread "Track how a user opens a link" already posted below...But I have a similar question:

How do I trap the event which gets triggered when the user opens a new window using the file menu.

I came across an event "NewWindow2" for IE, but could not find ways to trap this event....

Refer:

[msdn.microsoft.com...]

for more info on "NewWindow2".

Any ideas on how to trap this event...?

thnx.

jsphtml

10:02 pm on Dec 27, 2004 (gmt 0)

10+ Year Member



Hey,

Was not able to figure out, how to trap this event. But came up with another solution to disallow the user from opening a new window thru
File-->New-->Window. You guys can use this in ur websites if u want to...(By no means do I proclaim this method to be flawless, and if anybody can point out possible problems please do so...!)

Here is what I do:

a) I have named the parent frame/window in the app using JS -- window.name="LOGON";.

The parent window is the login page itself, since all the other pages once the user logs in are opened in this window.

b) Whenever the user opens, a new IE window, thru File->New->Window...the resulting window is unamed. So I use JS to check the name of the window and throw an error msg, like so:

if(stringTrim(window.name)=="")
{
document.location.href = 'erroMsg Action';
}

Thus, I am able to stop the user from spawning multiple windows in my app.

I think this method is very rudimentory and I guess there should be much better/robust methods out there to do what I am trying to do above.

Any other suggestions welcome!

thnx,