1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Disable Back Click

Discussion in 'HTML & JavaScript' started by Laser, Sep 26, 2009.

  1. Laser

    Laser Jr. VIP Jr. VIP Premium Member

    Joined:
    Apr 29, 2008
    Messages:
    822
    Likes Received:
    369
    Occupation:
    internet marketer
    Location:
    Exploiting the Net
    Home Page:
    Is there a solution to disable traffic's ability to back click and escape from a page?

    Who can solve this puzzle?

    thanks
     
  2. 195471

    195471 Regular Member

    Joined:
    Oct 11, 2008
    Messages:
    417
    Likes Received:
    260
    You can't "disable" a browser's back button, but you can use javascript to make it look like the button is disabled. Here's a tutorial:

    Code:
    http://www.htmlgoodies.com/tutorials/buttons/article.php/3478911
    P.S. If you're thinking of using this on a landing page promoted through AdWords, you will get slapped. ;)
     
  3. noidea

    noidea Junior Member

    Joined:
    Oct 1, 2008
    Messages:
    108
    Likes Received:
    34
    has anyone any experience on using this strategy with any adsense sites? Let us know.
     
  4. cyklotrial

    cyklotrial Regular Member

    Joined:
    Oct 13, 2008
    Messages:
    248
    Likes Received:
    82
    Location:
    Wonderland
    open in your page iframe. Load to this iframe different page to fill whole history memory (~50 different page's per tab in most popular browsers)
    eg.
    page1
    page2
    page1
    page2
    etc

    this way when someone will try click back button will only refresh your main page.

    Ok but what to do when someone will type in adressbar eg. google.com?
    Just use this code:
    HTML:
    var prevent = 0
    window.onbeforeunload = function() { prevent++; }
    
    setInterval(function() {
    	if (prevent > 0) {
    	prevent -= 2;
    	window.top.location = 'http://yourdomain.com/204.php';
    	}
    and put into 204.php file this:
    PHP:
    <?php
    header
    ("HTTP/1.1 204 No Content");
    ?>