Friday, 5 November 2010

JS Trick

Ever wondered how to close that damn browser window without getting a warning from the browser ?.

Well, I've gone through that many a times before when trying to close a window(subject)  from either the main window or any other window which did not create the subject.

and…and i remember the solution, which i had devised for IE. (not sure about other browsers and I'll leave that for you ).

You have to remember, the method creates a reference to the window.opener ??    (Hint, Hint! )

function CloseWindow(){

//removes the previous window.opener reference and

//tricks the browser not to display the annoying warning message.

window.opener = ‘fake’;



Winking smile

No comments:

Post a Comment