DOMException.code

DOMException 接口中的 code 是一个只读属性,他返回了一个包含了 错误常量 的简短数字 ,或者在没有匹配到时返回 0 。这个字段产生于历史原因,在新的DOM异常中已停止使用,改为在 DOMException.name 属性中推送此信息。

语法

var domExceptionCode = domExceptionInstance.code;

一个数字

规范

规范 状态 评论
Web IDL
code
Candidate Recommendation  

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
codeChrome Full support YesEdge Full support 12Firefox Full support 1IE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

文档标签和贡献者

此页面的贡献者: mdnwebdocs-bot, ch4o5
最后编辑者: mdnwebdocs-bot,