值
字符串
示例
js
window.addEventListener("error", (ev) => {
console.log("文件 " + ev.filename + " 中出现错误");
});
规范
| Specification |
|---|
| HTML> # dom-errorevent-filename> |
此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
备注: 此特性在 Web Worker 中可用。
ErrorEvent 接口的 filename 只读属性返回包含发生错误的脚本文件的名称的字符串。
字符串
window.addEventListener("error", (ev) => {
console.log("文件 " + ev.filename + " 中出现错误");
});
| Specification |
|---|
| HTML> # dom-errorevent-filename> |