Leaving Website Prompt

Discussion in 'Web Design and Development' started by sbryan, Jul 1, 2010.

  1. sbryan macrumors member

    Joined:
    Jun 6, 2007
    #1
    I finished a Wordpress-based website for a client several months ago and I received an upgrade request just recently. They create and maintain their own content, but they also have a few links for external vendor deals. These vendors are fixed and the links are imbedded in a static sidebar.

    The client would like to inform users they're leaving the client's website when these vendor links are clicked with a simple "Yes or No" prompt.

    What's a good solution for achieving this?

    Thanks!

    P.S. I don't like it, but they insist they're required to inform users of where they're going (even if they should be able to figure it out).
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    On some of my external links I give them a class attribute of "external" then style them in CSS differently. Namely I give them a little icon like used on Wikipedia showing the visitor the link is for another site.

    This could be done via JavaScript where you attach an event to these links, then prompt them, and depending on their response you return true or false and this will either carry out the link or cancel it. This is nice in that if the visitor has JavaScript disabled, the link will still work normally. It's more invasive to the user though. I really hate sites that prompt me on exit. My bank does it when logging off, and it annoys me every time, so much that i almost consider not logging off and just going to a different page, which is less secure.
     
  3. rickiac macrumors newbie

    Joined:
    Dec 10, 2007
    #3
    Leaving Website Prompt

    Have each link point to a separate page within the site that displays the "external link - your leaving our site" message then have that page use meta refresh to open new browser window to the linked site. Advantage: no java, no pop-ups, works in every browser. Disadvantage: You have to create an intermediate page for each link.
     
  4. sbryan thread starter macrumors member

    Joined:
    Jun 6, 2007
    #4
    I hear you. It's annoying, but it is for an Employee's Credit Union landing page, so they may be required to inform users they're leaving the Union's page.

    I would need some kind of Javascript prompt.
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    Are you asking for how to do that or were you just looking for alternatives to the JavaScript method?
     
  6. sbryan thread starter macrumors member

    Joined:
    Jun 6, 2007
    #6
    I'm asking how to achieve a prompt that clearly informs users they're leaving the main [secure] website. This would rule out secondary link colors, helpful graphics, and subpages. It needs to be obtrusive.

    It sounds completely asinine, trust me, but they were quite clear that they wanted a prompt to interfere with the flow of the website.

    Ah, clients.
     
  7. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #7
    PHP:
    function TheyreLeaving()
    {
        return 
    prompt("You should know this link is taking you away from this web site. Do you wish to proceed?");
    }
    Then you just attach a onclick event to the external links.
     
  8. carlosbutler macrumors 6502a

    carlosbutler

    Joined:
    Feb 24, 2008
    Location:
    London City
    #8
    On each anchor element use an onclick to run a JS function that creates a pop-up and then redirects you to the page. Only one function is needed of course as you use a function variable being the site address.

    Other way is to see if the function only creates the prompt, and then using the standard href in the anchor tag to take you to the correct page. Not sure if all browsers can do that.
     

Share This Page