HTMLAnchorElement:target 属性
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
HTMLAnchorElement
接口的 target
属性是一个字符串,用于指示在何处显示链接的资源。
值
示例
html
<a href="www.example1.com" class="link1" target="_blank">示例 1</a>
js
const link = document.querySelector(".link1");
console.log(link.target); // 输出:“_blank”
规范
Specification |
---|
HTML Standard # dom-a-target |
浏览器兼容性
BCD tables only load in the browser