isMobile.js 461 B

123456789101112131415
  1. ;(function () {
  2. // 判断移动端
  3. var sUserAgent = navigator.userAgent.toLowerCase()
  4. if (/ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(sUserAgent)) {
  5. //跳转移动端页面
  6. if (window.location.href.indexOf('mobile') < 0) {
  7. if(window.location.pathname =='/'){
  8. window.location.replace('/m_user') //跳转后没有后退功能
  9. }
  10. }
  11. } else {
  12. // PC端
  13. console.log('pc',)
  14. }
  15. })()