HTMLHyperlinkElementUtils.search

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.

HTMLHyperlinkElementUtils.search 属性是一个搜索字符串,也叫做查询字符串,它是一个 USVString ,包含 '?' 和随后的 URL 参数。

语法

string = object.search;
object.search = string;

示例

js
// 让一个
// <a id="myAnchor" href="https://developer.mozilla.org/zh-CN/docs/HTMLHyperlinkElementUtils.search?q=123" />
//  元素在文档里

let anchor = document.getElementById("myAnchor");
let result = anchor.search;
// 返回:'?q=123'

规范

Specification
HTML Standard
# dom-hyperlink-search-dev

浏览器兼容性

BCD tables only load in the browser

相关链接