window.onerror()仅从数据的嵌入式<script>内的错误中接收“脚本错误”:URI网站

时间:2019-04-13 18:39:04

标签: javascript error-handling data-uri

我正在尝试使用base64编码并加载了 data: URI的页面上的 window.onerror 函数捕获所有错误,但是我只能得到< code>脚本错误。作为错误消息,而不是完整错误。 当我直接从文件中加载网页时,我得到了完整的错误消息,因此看起来它必须对页面位于 data: URI中进行某些处理。

我已经尝试使用 <身体>     

data: URI:

 <代码>数据:text / html的; BASE64,PCFET0NUWVBFIGh0bWw + CjxodG1sPgo8aGVhZD4NCgk8IS0tIDxtZXRhIGh0dHAtZXF1aXY9IkNvbnRlbnQtU2VjdXJpdHktUG9saWN5IiBjb250ZW50PSJzY3JpcHQtc3JjICo7Ij4gLS0 + Cgk8bWV0YSBjaGFyc2V0PSJ1dGYtOCI + Cgk8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0iaW5pdGlhbC1zY2FsZT0xLCB3aWR0aD1kZXZpY2Utd2lkdGgiPgoJPHN0eWxlPgoJCWJvZHkgewoJCQl3aGl0ZS1zcGFjZTogcHJlOyAKCQkJZm9udC1mYW1pbHk6IG1vbm9zcGFjZTsKCQl9Cgk8L3N0eWxlPgoJPHNjcmlwdCBjcm9zc29yaWdpbj0iY3Jvc3NvcmlnaW4iPgoJdmFyIG9sZEhhbmRsZXIgPSB3aW5kb3cub25lcnJvcjsKCXdpbmRvdy5vbmVycm9yID0gZnVuY3Rpb24gKG1lc3NhZ2UsIHNvdXJjZSwgbGluZSwgY29sLCBlcnJvcikgewoJCW9sZEhhbmRsZXIgJiYgb2xkSGFuZGxlcihtZXNzYWdlLCBzb3VyY2UsIGxpbmUsIGNvbCwgZXJyb3IpOwoJZXJyb3IgPSBlcnJvciB8fCB7fTsKCQllcnJvci5tZXNzYWdlT25FcnJvciA9IG1lc3NhZ2U7CgkJZXJyb3Iuc291cmNlID0gc291cmNlOwoJCWVycm9yLmxpbmVubyA9IGxpbmU7CgkJZXJyb3IuY29sbm8gPSBjb2w7Cg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