SiteExperts.com Logo Home | Community | Developer's Paradise | Jobs
User Groups | Site Tools | Site Information | Search

Inside Technique : SiteExperts.com Free Me! Tool
By Scott Isaacs

I am in the process of building a new house. The other night I was looking around the web for information on bathroom fixtures and accidentally ended up at an adult site. Unfortunately, everytime I tried to leave the site, it would keep reloading in a new window. While I was finally able to kill the browser, I almost resorted to rebooting my machine.

It turns out that some sites have discovered, with a little creative scripting, you can prevent users from leaving. We have come up with a very simple solution that you can use to force the browser to close from any site. We aptly named this the Free Me! Tool. This tool works in both Internet Explorer and Netscape. It works by overriding scripts on the web-page so that it can immediately close the browser window.

You can install the script in one of two ways (you can even do both). 1) Drag the "Free Me" link below to your personal links toolbar, or 2) Right-click on the link and add it to your favorites. In Internet Explorer you may get a warning about the link being potentially unsafe. This is a general warning because you are adding a small snippet of code to your favorites menu. You will need to answer "Yes" to this question for the tool to be installed. If you are concerned about the safety of this script, we provide the full source below for your review.

Free Me!

After installing the tool, if you ever reach a page that won't let you leave just select "Free Me!" from your favorites or your toolbar. Clicking the button automatically closes your browser. In some cases, you may receive a message letting you know the window is closing. May you never be held hostage at an unwanted site again!

The Code

The code behind "Free Me!" is extremely simple. We erase any event handlers that may be used to hold you captive and then close the window:

<A 
  HREF="javascript:
        window.onload=window.onunload=window.onbeforeunload=null;
        window.close();
        // Copyright 2000 SiteExperts.com">
   Free Me!
</A>
Discuss and Rate this Article