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

Join now to receive helpful resources, tips, and tutorials in your inbox.

Is it time for a website upgrade?

Enter To Win A Free Website Audit

Sign up below for a chance to win a complimentary website audit featured on our YouTube channel. A new winner is chosen every month!