runtime.getBrowserInfo() 编辑
Returns information about the browser in which the extension is installed.
This is an asynchronous function that returns a Promise
.
Syntax
var gettingInfo = browser.runtime.getBrowserInfo()
Parameters
None.
Return value
A Promise
that will be fulfilled with an object which has the following properties:
name
: string value representing the browser name, for example "Firefox".vendor
: string value representing the browser's vendor, for example "Mozilla".version
: string representing the browser's version, for example "51.0" or "51.0a2".buildID
: string representing the specific build of the browser, for example "20161018004015".
Browser compatibility
BCD tables only load in the browser
Examples
Get and log the browser's name:
function gotBrowserInfo(info) {
console.log(info.name);
}
var gettingInfo = browser.runtime.getBrowserInfo();
gettingInfo.then(gotBrowserInfo);
AcknowledgementsMicrosoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论