Copied!
It's on your clipboard.
You’ve been offline for 0 second. Please check your Internet connection.

Help Us Improve

Found an issue or have an idea? Let us know.
Select all that apply...
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Open External Links In New Tab
Preview
Overview

This snippet makes all external links on your site open in a new tab. It also adds the rel="noopener noreferrer" attribute for better security and performance.

Documentation
Code Setup
Walkthrough

Copy To Elementor
Setup: Add Custom Script

Add this code with a snippets plugin right before the closing </body> tag.

Language
Copy
jQuery(document).ready(function ($) {
  $('a[href^="http"]').each(function () {
    if (this.hostname !== window.location.hostname) {
      $(this).attr('target', '_blank').attr('rel', 'noopener noreferrer');
    }
  });
});

Language
Copy

Language
Copy

Language
Copy

Language
Copy

Language
Copy
Publish and preview live

Some solutions only work on the live site. Always publish and test after each change, as results may not appear in the editor.

Absolutely Codefree
If you were expecting some fancy snippet, sorry. This one runs just fine on its own.
C’mon, You Got This
Do we really need to spell this one out? It’s as straightforward as it gets.
Resorce Details
Collection
Basics
Category
Category
Utilities
Interaction
Builder
Last Updated
September 16, 2025