如何检测Chrome应用中的XMLHttpRequest错误

时间:2022-10-28 10:47:58

How do I detect XMLHttpRequest errors in Chrome App.

如何在Chrome App中检测XMLHttpRequest错误。

For example I want to know when net::ERR_NAME_NOT_RESOLVED is being generated so I can output an error message to the user.

例如,我想知道何时生成net :: ERR_NAME_NOT_RESOLVED,因此我可以向用户输出错误消息。

XMLHttpRequest.onerror is triggered however I cannot distinguish between this error or net::ERR_INSECURE_RESPONSE

触发XMLHttpRequest.onerror然而我无法区分此错误或net :: ERR_INSECURE_RESPONSE

1 个解决方案

#1


0  

If you want more control, you could use the chrome.sockets permission and determine the connection problem "manually". I do something like this in chromesocketxhr.js

如果您想要更多控制,可以使用chrome.sockets权限并“手动”确定连接问题。我在chromesocketxhr.js做了类似的事

#1


0  

If you want more control, you could use the chrome.sockets permission and determine the connection problem "manually". I do something like this in chromesocketxhr.js

如果您想要更多控制,可以使用chrome.sockets权限并“手动”确定连接问题。我在chromesocketxhr.js做了类似的事