手机WAP转跳网页代码,兼容微信代码

  • A+
所属分类:HTML5
源代码   
  1. <meta name='viewport' content='width=device-width, target-densityDpi=device-dpi, user-scalable=yes'> <script> var viewport = document.querySelector('meta[name=viewport]'); var winWidths=$(window).width(); var densityDpi=640/winWidths; densityDpi= densityDpi>1?300*640*densityDpi/640:densityDpi; if(isWeixin()){ viewport.setAttribute('content', 'width=640, target-densityDpi='+densityDpi); }else{ viewport.setAttribute('content', 'width=640, user-scalable=no'); window.setTimeout(function(){ viewport.setAttribute('content', 'width=640, user-scalable=yes'); },1000); } function isWeixin(){ var ua = navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i)=='micromessenger') { return true; } else { return false; } } </script>
  • 我的微信小程序
  • 长按二维码识别查看微信小程序
  • weinxin
  • 我的个人微信号
  • 长按识别加我个人微信号
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: