« Bloody Apple crappy syslogd nearly fried my new poota | Main | Attempting to install PHP YAZ »

August 18, 2008

A JS function to stop access to external links

Cumbria BBC
<script type="text/javascript">
function is_external(url){

if(url.indexOf('cumbria.ac.uk') > -1){ return true; }

else{ alert("Sorry! You can't access external links from here."); return false; }
}
</script>

<p>
<a href="http://www.cumbria.ac.uk" onclick="return is_external(this.href + '')">Cumbria</a>
 <a href="http://www.bbc.co.uk" onclick="return is_external(this.href + '')">BBC</a>
</p>

 

Posted by pj at August 18, 2008 10:30 AM

Comments