The first method is to use jquery to implement it. The principle is to first find the external link in the site, and then add the target=_blank" attribute to the link. The code is as follows:
jquery opens in a new window
$("a[href*='http://'] :not([href*='" location.hostname "']),[href*='https://']:not([href*='" location.hostname "'])")
. addClass("external")
.attr("target","_blank");
js opens in a new window
var aTag = document.getElementsByTagName('a');
for(i in aTag){
aTag[ i].target='_blank';
}
html method
Add
to the latest page of the page. Copy the code as follows
You can open all pages in a new window