1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do I create an exit popup?

Discussion in 'JavaScript' started by rebel_989, Sep 22, 2016.

  1. #1
    How do I create an exit popup like those you see in the marketing sales pages?
     
    rebel_989, Sep 22, 2016 IP
  2. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #2
    qwikad.com, Sep 22, 2016 IP
  3. rebel_989

    rebel_989 Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    13
    #3
    Thanks, but I was looking for something more simple, like an alert window that shows up when the user tries to close the page, that redirects to another page with another offer if the user choose to stay. Sorry if I can't explain it better, but I have very basic knowledge of Javascript.
     
    rebel_989, Sep 23, 2016 IP
  4. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #4
    You can use this:

    
    <script type="text/javascript">
    window.onbeforeunload = function(e) {
        return '';
    };
    </script>
    
    Code (markup):
    Or this:

    
    <script type="text/javascript">
    window.onbeforeunload = function(e) {
        e = e || window.event;
        e.preventDefault = true;
        e.cancelBubble = true;
        e.returnValue = '';
    }
    </script>
    
    Code (markup):
     
    qwikad.com, Sep 23, 2016 IP
  5. rebel_989

    rebel_989 Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    13
    #5
    I put the code on my page but it seems not to work. Maybe something is missing.
     
    rebel_989, Sep 24, 2016 IP
  6. rebel_989

    rebel_989 Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    13
    #6
    I just checked on Google and I found that in Firefox your code doesn't work. Thank you anyway.
     
    rebel_989, Oct 1, 2016 IP
  7. victorvictories

    victorvictories Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #7
    Try this adding HTML and CSS to the popup.

    Method One
    This is a pure JavaScript solution, where you set the html and css option in the bioEp.init function call.

    bioEp.init({
    html: '<div id="content">Your HTML goes here</div>',
    css: '#content {font-size: 20px;}'
    });
     
    victorvictories, Oct 1, 2016 IP