Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sbryan

macrumors member
Original poster
Jun 6, 2007
96
0
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).
 
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.
 
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.
 
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.
 
Are you asking for how to do that or were you just looking for alternatives to the JavaScript method?

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.
 
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.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.