Posts

Showing posts from July, 2013

Message presented you leave your site

Image
This time,I present in JavaScript (Jquery) code that checks whether you leave your domain. If so - popup alert to informing you that you are leaving the domain $(document).ready( function () {     $( "a" ).click( function ( event ) {         // check if the target link is your.domain.com         // if not will show alert message         if ( this .href.indexOf( "your.domian.com" ) == -1) {             if ( this .href.startsWith( "http" )) {                 event .preventDefault();                 var linkLocation = this .href;                 alert( ' Note that you are ...