isMobile.js 610 B

12345678910111213141516171819202122232425
  1. ;(function () {
  2. // 判断移动端
  3. var sUserAgent = navigator.userAgent.toLowerCase()
  4. if (
  5. /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(
  6. sUserAgent
  7. )
  8. ) {
  9. //跳转移动端页面
  10. if (window.location.href.indexOf('mobile') < 0) {
  11. window.location.replace('/user/m_user') //跳转后没有后退功能
  12. }
  13. } else {
  14. // PC端
  15. }
  16. })()
  17. (function(window){
  18. window.onresize=function(){
  19. rem();
  20. }
  21. function rem(){
  22. document.documentElement.style.fontSize = document.documentElement.clientWidth /7.2 + "px";
  23. }
  24. rem();
  25. })(window);