External URL Notification Popup

Home Elementor External URL Notification Popup

September 29, 2022

In this tutorial I will show you a free and easy way to have a browser popup notification when a user clicks on an external link on your website.

I will be using Elementor Pro to pull off this effect, but since it’s just simple JavaScript you can use this code on any website.

Timestamps:

  • 0:00 Introduction
  • 1:38 Tutorial Begins

Credits:
https://codepen.io/baykodnet/pen/pGPPeZ

JavaScript Code:

				
					<script>
jQuery(function($){
    $('a').on('click', function() {
   if ( this.host !== window.location.host ) {
      var thisHrefHere = this.href;
      if ( window.confirm('Warning! You are now leaving this website. You clicked on the external URL: '+thisHrefHere+'') ) {        
      }else {         
         return false;
      }    
   }
});
});
</script>
				
			

*Some of the links on this page are affiliate links, meaning we may receive a commission if you follow them. This allows us to continue providing free content and educational resources for you. Thank you for supporting our small business!

More Free Resources

Join Our Community

Wicky Design YouTube

Get our latest videos by subscribing for FREE to our YouTube channel. New videos are uploaded weekly!

Join Our Community

Sign up to receive free resources in your inbox every week.

Wicky Design YouTube

Join Our Community

Never miss a post! Join now to receive helpful resources, tips, and tutorials in your inbox weekly. Registration is FREE and emails are delivered every Monday morning.