Start New Discussion within our Web Development Community

i am using ASP.NET
and i am able to detect the close the tab where's the <body onunload="xxx">
but i don't know inside the xxx method how to to another page with new window.

It is not good practice to open another window when another is closed. This irritates your customers/viewers and will typically kill any chance you have at having them repeat visitors.

<body onunload="xxx()">

//funny enough, this is typically the type of site that employs this technique.
function xxx(){,name,specs,replace);

I haven't tested the code, you'll also need to replace the URL, name... with what you need.

Before you implement this, please think about why you are doing this and if it really is needed as it WILL piss people off and make it so that people won't return to your site.

This should be good for IE, but for Chrome, you'd have to have the user's browser configured to allow pop-ups.

<body onunload="popup()">
  function popup() {
    popupWin ='','Pop-Up','width=640, height=480')



And I agree that you are going to upset your visitors if you open a new window when they close your page.

This question has already been answered. Start a new discussion instead.