当前位置: 代码迷 >> 综合 >> 切换移动端/pc
  详细解决方案

切换移动端/pc

热度:28   发布时间:2024-01-30 20:18:42.0
// 切换移动端/pc
function switchViewTemplate() {if (window.location.search.indexOf('type=media') > 0) returnvar winWidth = '';if (window.innerWidth) {winWidth = window.innerWidth;} else if ((document.body) && (document.body.clientWidth)) {winWidth = document.body.clientWidth;}var urlPath = window.location.href.split('index.html')[0];if (/(iPhone|Android)/i.test(navigator.userAgent) || winWidth <= 750) {window.location.href = urlPath + "mobile.html";}
}

 

  相关解决方案