Disclamer

Visit our disclaimer policy before making any changes to your system which may negatively impact the performance or make your system unresponsive.

How To Create External Link Popup

Using Elementor Pro or other WordPress plugins to create a popup when someone clicks an external link to let them know they are leaving.

Table of Contents

Using Elementor

In this example, we are using Elementor Pro; this can also be done using other plugins that allow you to modify the WordPress code.

  1. On your WordPress dashboard, navigate to Elementor -> Custom Code.
  2. Hit the “Add New Button.”
  3. Give it a name and copy the code in the next section
  4. Hit the Blue “Publish” button
  5. Set the conditions; on my site, it is set to the Entire Site.

Bam, now people will get a popup when they click external links. 

Code

				
					<script type="litespeed/javascript">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!1}}})})</script>
				
			

Contact Us