下面是js代码
socket = new WebSocket(uri);
socket.onopen = function () {
console.log("connected to " + uri);
}
socket.onclose = function (e) {
console.log("connection closed (" + e.code + ")");
}
socket.onmessage = function (e) {
console.log("message received: " + e.data);
}
socket.onerror = function (e) {
alert(JSON.stringify(e));//这里报错{"isTrusted":"true"}
console.log("error");
}
你好,在safari上也是能复现这个问题,具体的错误原因也没有打印出来,先排查下具体错误原因,详细错误原因可参考https://stackoverflow.com/questions/44815172/log-shows-error-object-istrustedtrue-instead-of-actual-error-data
测试地址
https://dly.jinglingmall.net/test.aspx
安卓和低版本ios没有弹窗
ios13以上会弹窗