Created 1 January 2002, Updated 22 April 2013

Outbound Link Confirmation

I happen to think that limiting users travels on a website is pretty rude, but there are times when you want to let users know that by clicking a certain link, they will be leaving your site.

For those times, I offer an outbound link confirmation. It will prompt the user to confirm that they want to leave the website.

So here's the sample in action:

visit google.com

And here's the Source Code in the HTML

<a href="http://www.google.com/" onclick="return outboundLink();">visit google.com</a>

And this is the function to include in the <head> of any web page that will use this script:

<script language="JavaScript" type="text/javascript">
<!--
function outboundLink() {
	return confirm("You are now leaving this web site!\nDo you want to continue?");
}
//-->
</script>