Skip to content
SimpleConvertSimpleConvert

Open Link in New Window Code

Generate a link that opens in a new tab, with rel=noopener included automatically so the new page cannot manipulate the one it came from.

How to use it

  • Fill in the fields — the code and the preview update as you type.
  • Copy the generated HTML straight into your page.
  • The preview renders the real markup, so what you see is what you get.

Examples

Any URL<a href="…" target="_blank" rel="noopener noreferrer">

target="_blank" opens a link in a new tab instead of navigating away from the current page. On its own that used to be a real security hole: the new page gets a JavaScript reference to the tab it came from, through window.opener, and can use it to silently swap the original page for a phishing look-alike — a technique called tabnabbing.

This generator always adds rel="noopener noreferrer" alongside target="_blank", which severs that reference. Modern Chrome and Firefox apply noopener to _blank links by default, but Safari and older browsers do not, so writing it explicitly is still the safe habit rather than relying on a browser default.

noopener vs noreferrer

noopener blocks the window.opener reference — that is the part that stops tabnabbing. noreferrer does something separate: it stops the browser sending a Referer header to the new page, so the destination site cannot see which page linked to it.

Including both, as this generator does, covers both cases and works across every browser in current use.

When a new tab is the right call

Opening a link in a new tab takes a decision away from the reader, who could already middle-click or Ctrl-click to do it themselves if they wanted to. Use it sparingly — mainly for links that would cost the visitor real work to lose, such as sending them away from a half-filled form, or for links to a genuinely separate destination like a downloadable document or an external reference a reader will want to keep the current page open alongside.

Questions people ask

Why is rel=noopener needed?

Without it, the opened page gets a reference to yours through window.opener and can redirect it — a real phishing route. Modern browsers default to noopener, but older ones do not.

Should every external link open in a new tab?

No. It takes control away from the reader, who can already middle-click. Reserve it for cases where losing the current page would cost them work, such as a part-filled form.

Is anything uploaded?

No. Everything runs in your browser — no file, image or snippet you use here ever leaves your device.

Runs entirely in your browser. Nothing you type is uploaded, logged or shared.

Last updated 22 August 2026