besure_bit
liutao 2 weeks ago
parent 89c8247f22
commit 4130b675ae

@ -147,7 +147,34 @@
</div>
</div>
</div>
<script src="/hiprint-edge-fix.js"></script>
<!-- Edge 兼容hiprint socket.io 连接添加 polling 降级策略,防止 WebSocket-only 连接在 Edge 下失败 -->
<script>
(function() {
try {
if (window.__hiprintEdgeFixApplied) return;
var _io = window.io;
Object.defineProperty(window, 'io', {
configurable: true,
enumerable: true,
get: function() { return _io; },
set: function(fn) {
if (typeof fn === 'function' && fn !== _io && !fn.__hiprintPatched) {
var _orig = fn;
_io = function(url, opts) {
opts = Object.assign({}, opts || {});
opts.transports = ['websocket', 'polling'];
return _orig(url, opts);
};
_io.__hiprintPatched = true;
} else {
_io = fn;
}
}
});
window.__hiprintEdgeFixApplied = true;
} catch(e) { console.warn('[hiprint-fix]', e); }
})();
</script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

@ -1,4 +1,4 @@
<template>
<template>
<ContentWrap>
<div class="print-config-header">
<div class="print-config-title-row">
@ -191,8 +191,14 @@ const ensureHiprintInit = () => {
return
}
// Edge <EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>Ϊ hiwebSocket <EFBFBD><EFBFBD><EFBFBD>?polling <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>? // ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?transports:["websocket"]<EFBFBD><EFBFBD>Edge <EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WebSocket <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
// Edge hiwebSocket ?polling ? // ?transports:["websocket"]Edge WebSocket
const socket = getHiwebSocket()
// socket patched start 使 polling
if (socket?.socket) {
socket.stop?.()
}
if (socket?.start && !socket.__transportPatched) {
const originalStart = socket.start.bind(socket)
socket.start = function (callback?: any) {
@ -490,3 +496,4 @@ onMounted(async () => {
line-height: 1.5;
}
</style>

Loading…
Cancel
Save