Skip to content

Commit

Permalink
feat: ie检测
Browse files Browse the repository at this point in the history
  • Loading branch information
Souma-Sumire committed Dec 11, 2024
1 parent 47fdb40 commit c860199
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/utils/useWebSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import { ElMessageBox } from 'element-plus'
import { callOverlayHandler } from '../../cactbot/resources/overlay_plugin_api'
import actWS from '@/assets/actWS.webp'

function isIE() {
const userAgent = window.navigator.userAgent
const isMSIE = userAgent.includes('MSIE ') // IE 10 及以下
const isTrident = userAgent.includes('Trident/') // IE 11
return isMSIE || isTrident
}

function addOverlayWsParam() {
const currentUrl = window.location.href
const [basePart, hashPart = ''] = currentUrl.split('#')
Expand Down Expand Up @@ -75,6 +82,14 @@ export function useWebSocket(config: {
}
}
onMounted(() => {
if (isIE()) {
ElMessageBox.alert('不支持 IE 浏览器,请使用 Chrome、Firefox、Edge 等现代浏览器访问。', '提示', {
type: 'error',
showConfirmButton: false,
showClose: false,
})
return
}
watch(wsConnected, (value) => {
if (value) {
ElMessageBox.close()
Expand Down

0 comments on commit c860199

Please sign in to comment.