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

Exit Redirect

Discussion in 'Blogging' started by trevormorley, Jul 26, 2010.

  1. trevormorley

    trevormorley Junior Member

    Joined:
    Feb 25, 2010
    Messages:
    164
    Likes Received:
    44
    Can anybody tell me if there is a wp plugin or methos whereby on leaving my page that the user is redirected to another one - I currently use exitwindow but it is easy for the user to click on the pop up and cancel the redirect, I don't want them to have the choice, I just want it to take them there...
     
  2. dnreg

    dnreg Jr. VIP Jr. VIP Premium Member

    Joined:
    Sep 16, 2009
    Messages:
    153
    Likes Received:
    118
    I don't know of a plugin, but it's a very simple javascript that does this. Look up onexit javascript redirect in Google.
     
    • Thanks Thanks x 1
  3. Dark Knight

    Dark Knight Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 15, 2009
    Messages:
    731
    Likes Received:
    1,192
    I am looking for the samething for wordpress but couldn't find it anywhare??
     
  4. LinkBlog

    LinkBlog Newbie

    Joined:
    Jun 30, 2010
    Messages:
    18
    Likes Received:
    3
    Try using Exit Rescue Plugin
     
  5. Dark Knight

    Dark Knight Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 15, 2009
    Messages:
    731
    Likes Received:
    1,192
    it is giving a option to visitor, I don't wanna give them option though :D
     
  6. akleinesw

    akleinesw Newbie

    Joined:
    Feb 27, 2011
    Messages:
    1
    Likes Received:
    1
    Location:
    Spain
    It seems like there is no way to avoid the option. I have found the following comment

    "You actually can't, directly. The browser takes charge of showing the confirmation, and either continuing the navigation if OK, or doing nothing if Cancel. You don't get to find out whether the user clicked OK until you get the final unload, by which point it's too late."

    A simple code (including the option) that worked for me is:
    <script type="text/javascript">
    window.onbeforeunload = function (evt) {
    var message = 'Are you sure you want to leave?';
    if (typeof evt == 'undefined') {
    evt = window.event;
    }
    if (evt) {
    evt.returnValue = message;
    window.location = "yourURLhere";
    }
    return message;
    }
    </script>
     
    • Thanks Thanks x 1
  7. adminx

    adminx Registered Member

    Joined:
    Apr 19, 2008
    Messages:
    61
    Likes Received:
    14
    I know this is an old thread but I just found it and tried
    I pasted the script into the header and it works but I still get the
    window "This page is asking if you want to leave"

    is there a way to force the redirect without getting the window?

    thx
     
  8. captchadreams

    captchadreams Power Member

    Joined:
    Sep 19, 2008
    Messages:
    505
    Likes Received:
    126
    I think it's a security feature in the browsers.. it's not the actual code or plugin popping this up.. but when the code does try to redirect them.. the browser pops up that menu as a security feature.. otherwise you could just keep redirecting them until they closed out the browser.. which is malicious
     
  9. Nookie Monster

    Nookie Monster Senior Member

    Joined:
    Mar 28, 2010
    Messages:
    968
    Likes Received:
    463
    Location:
    USA
    A member here produced a plug in called Bounce Rate. Search the forum for the thread. I haven't tried it yet so YMMV.
     
  10. hunar

    hunar Regular Member

    Joined:
    Jan 1, 2009
    Messages:
    479
    Likes Received:
    178
    Location:
    Minnesota
    There is one called exit rescue. It does give the option for user to stay or leave but it will automatically try to load whatever site you want in the background. Not sure if that's what your looking for?
     
  11. hungbli

    hungbli Junior Member

    Joined:
    Jul 28, 2008
    Messages:
    116
    Likes Received:
    10
    Occupation:
    seoer
    Home Page:
    HI,
    It show the message but not redirect to the website, what's wrong with wordpress 3.9.1?
     
  12. IMCapitalist

    IMCapitalist Jr. VIP Jr. VIP Premium Member

    Joined:
    Jan 21, 2014
    Messages:
    1,087
    Likes Received:
    60
    Location:
    Google Universe
  13. bobmarleyfans

    bobmarleyfans Newbie

    Joined:
    Apr 12, 2013
    Messages:
    4
    Likes Received:
    2
    Thanks akleinesw for this. but my problem is,the current settings shows the message ,when i try to view the internal pages or external pages.
    My requirement is simple,the page will shows/redirect only if the visitor try to close the window ,but if they visit other external or internal pages of web site means it shouldn't show the message or redirects.

    Thanks in advance
     
    Last edited: Jun 24, 2014
  14. wickid

    wickid Junior Member

    Joined:
    May 8, 2008
    Messages:
    156
    Likes Received:
    52
    Home Page:
    I have the perfect solution for you. Check out BackJacker and stop giving users the option to leave or stay and send them wherever you want when they click the back button.