We use _blank
for a href
URL. My website have some iframe, ads from Adsense, Taboola, etc. When user click on my iframe or ad it will getting opened in same window.
Is there anyway to force all the URL (Including Iframe, Ads, etc) to open in new Tab. so whenever someone click on link or ads, it will get opened in new window.
i am looking for a code which i can add in head
or potion of div
and it force to open i new tab.
I am trying
let links = document.links;
for (let i = 0; i < links.length; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
}
}
or
var myWin = window.open(strUrl, strWindowName);
var myWin = window.open(strUrl, strWindowName, [strWindowFeatures]);
or
<base target="_blank">