• Resolved megank92

    (@megank92)


    I’m looking to change the link / page that the exit icon routes to. Right now, when you click the “x” to exit the pop-up, it just closes the pop-up. I’d like to close out the pop-up AND redirect users to another page when they click the “x” as opposed to just closing out the pop-up. Is this possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @megank92,

    Sure, I will be happy to guide you in setting redirection to a particular page or URL when the popup is closed.

    You can simply add the following script via the Code Module into your Popup Divi Area, and replace the existing (google.com) URL with your desired page URL.

    Note: This is a temporary workaround solution to help you in setting redirection when the popup is closed.

    Script [1] (This script applies redirection to all the existing popups on the page):

    <script>
    (function() {
      DiviArea.addAction('show_area', function(area) {
        DiviArea.addAction( 'close_area', function( area, closeType ) {
                // Execute the redirection when the close button is clicked. Replace the URL with your desired page URL.
                window.location.;
        });
      });
    })();
    </script>

    See Here: https://share.zight.com/bLuymx24

    Script [2] (This script applies redirection to specific popup on the page):
    (Note: Replace ‘mypopup’ with your specific popup ID for which you want to enable the redirection)

    <script>
    (function() {
      DiviArea.addAction('show_area', function(area) {
        if (! area.hasId('mypopup')) { return; }
        
        //Replace 'mypopup' with your specific popup ID for which you want to enable the redirection.
        
        DiviArea.addAction( 'close_area', function( area, closeType ) {
                // Execute the redirection when the close button is clicked. Replace the URL with your desired page URL.
                window.location.;
        });
      });
    })();
    </script>

    I have also demonstrated the same in the video below.
    See here: https://share.zight.com/E0umqgAw

    I hope this information helps. Please do not hesitate to ask any further questions. Thank you.

    Thread Starter megank92

    (@megank92)

    Thank you! This worked perfectly. I appreciate all of your help and guidance.

    Hi @megank92,

    I am glad to hear that. Please do not hesitate to ask any further questions. Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirect page upon exit’ is closed to new replies.