iframe

发布时间 2023-04-20 17:16:46作者: 又回到了起点
// 浏览器
export const pcBrowser = (()=> {
const sUserAgent = window.navigator.userAgent.toLowerCase();
const bIsIpad = sUserAgent.match(/ipad/i) == 'ipad';
const bIsIphoneOs = sUserAgent.match(/iphone os/i) == 'iphone os';
const bIsMidp = sUserAgent.match(/midp/i) == 'midp';
const bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == 'rv:1.2.3.4';
const bIsUc = sUserAgent.match(/ucweb/i) == 'ucweb';
const bIsAndroid = sUserAgent.match(/android/i) == 'android';
const bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce';
const bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile';
return !(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM);
})()

 

import {pcBrowser} from './jsBridge'


if (pcBrowser && window.top.location == window.self.location && !/\/iframe|localhost/.test(window.top.location.href) && !/(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\./.test(window.top.location.origin)) {
window.location.href = `${window.location.origin}/#/iframe`
}