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

Downsell without exit pop?

Discussion in 'HTML & JavaScript' started by OTrap, Jul 13, 2012.

  1. OTrap

    OTrap Jr. VIP Jr. VIP

    Joined:
    Jul 12, 2008
    Messages:
    2,286
    Likes Received:
    1,052
    Among Clickbank sites, it is relatively popular to add exit pops that direct people to downsell pages.

    However, I was curious if there was a way to forgo the exit pop and take them straight to the downsell.

    I know this can be done if a person clicks the "back" button using the following:
    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';
              });    
    });
    }
    I'm curious, however, if this can be done when people try to close the page as well.