make all links target new window

I was actually searching for a js way to do this, but i found this instead. Here is a really easy way to make all links target a _blank window. Just add this to your <head>.

<base target="_blank">

as a side note this can actually get annoying as you have to add target _self to make the link stay in the same window if you have _blank on all links, so i guess it depends if you have more links that you want external than you want to have.

<base target="_self">

here is the full usage for target

<a target="_blank|_self|_parent|_top|framename">

Demo

Page Views

This page has been viewed 64 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹