Skip navigation

How can you close window browser without get warning message like this
“The page is trying to close the window.” ?  This warning message shows up when you use Java Script syntax window.close(); or self.close();
window.close() checks window.opener. If “opener” equals empty string it suspects that we talk about parent window (not the one that was opened with window.open(…)) and pop-ups warning.

So we use this simple function :
// Work with Firefox, Netscape, IE, Opera
function closeWithoutWarning()
{
window.open(”,’_parent’,”);
window.close();
}

// Work with IE
function closeWithoutWarning2()
{
window.opener = “whatever”;
window.close();
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: