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

How is This Done?

Discussion in 'Clickbank' started by joaquin112, Jul 11, 2012.

  1. joaquin112

    joaquin112 Regular Member

    Joined:
    Apr 4, 2010
    Messages:
    285
    Likes Received:
    220
    Location:
    Queretaro!
    If you go to this sales page:

    http://www.power4home.com/MakeElectricity.php

    you will notice that if you hit the back button you are not presented with a popup like all the other CB sites. You are instantly taken to a squeeze page. I think this is a pretty good idea. Can anyone who knows Javascript tell me what's going on and what code he's using?
     
  2. Nitros

    Nitros Power Member

    Joined:
    Jan 30, 2009
    Messages:
    573
    Likes Received:
    295
    Code:
    var is_chrome = /chrome/.test( navigator.userAgent.toLowerCase() );
    var is_safari = /safari/.test( navigator.userAgent.toLowerCase() );
    var myvar = 0;
    var myexit = 0;
    
    if(is_chrome == true || is_safari == true) {
        YUI().use('history', function (Y) {
            var history = new Y.History({
                initialState: {kittens: null,}
              });
              
              history.addValue('kittens');
              
              Y.on('history:change', function (e) {
              if (myvar == 1){
                  myexit=1;
                  window.location ='/PAGEURL';
                  }
              myvar=myvar + 1;
              });    
    });
    }
    else{
    YUI().use('history', function (Y) {
            var history = new Y.History({
                initialState: {kittens: 'cat',}
              });
              
              Y.on('history:change', function (e) {
                  myexit=1;
                  window.location ='/PAGEURL';
              });    
    });
    }
    Just replace "PAGEURL" with the path where you want to redirect your visitors.
     
  3. OTrap

    OTrap Jr. VIP Jr. VIP

    Joined:
    Jul 12, 2008
    Messages:
    2,286
    Likes Received:
    1,052
    I've gotta wonder if this is possible when someone tries to close the page as well. Seems like it'd be a nice touch.