Word press fix how plugin works
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

We have a word press blog is using the plug-in called WP lap dance.
The way it works is this
a visitor is on our sales page watching the sales video

joblaunchformula.com/free-video/
when they attempt to leave that page, they pop up appears asking them to stay on the page
to get access to free stuff.
At this point, another page is supposed to load in the background joblaunchformula.com/ebook/

all of this "seems" to be working correctly except that:

1.) The video keeps playing in the background. Even though the user is at the new page.
(I think because the plug-in loads a new page into a frame?

2.) If they try to leave the page again, the pop-up appears again, putting the user into
a loop of pop-ups

can you fix?

Loading a page in the background sounds really shady and is a good way to annoy your users. Popups used for marketing (rather than for a legitimate reason like unsaved work) are equally bad. I know that this doesn't answer your question, but you should really consider not using this technique at all.
slang 9 years ago
awarded to Wikimedia

Crowdsource coding tasks.

1 Solution


Alright so, I will answer your two answers one at a time.

  1. To pause the video, just send the jwplayer().pause(true); command through javascript. (I have done this for you below)
  2. To prevent the user from getting a loop of popups use this code below:

    <script>
    staying_in_site = false;
    popup_shown = false;
    
    Event.observe(document.body, 'click', function(event) {
        if (Event.element(event).tagName == 'A') {
            // The person is staying in your site.
            // Don't show the popup
            staying_in_site = true;
        }
    });
    
    window.onunload = popup;
    
    function popup() {
        if(staying_in_site) {
            return;
        }
        // pause the player
        jwplayer().pause(true);
        if(popup_shown == false) {
            popup_shown = true;
            // the popup has not been shown
            alert('I see you are leaving the site');
            // run other code here
        } else {
            // the popup has shown already
        }
    }
    </script>
    

All you have to do now is to replace // run other code here with your popup code.

Opinion

I agree with slang800, it seems kinda shady.