js判断是手机端还是pc端访问】的更多相关文章

if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { window.location.href = "https://www.wonyen.com/"; }…
function isMobile(){ var sUserAgent= navigator.userAgent.toLowerCase(), bIsIpad= sUserAgent.match(/ipad/i) == "ipad", bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os", bIsMidp= sUserAgent.match(/midp/i) == "midp", b…
function check_wap() { if (isset($_SERVER['HTTP_VIA'])) return true; if (isset($_SERVER['HTTP_X_NOKIA_CONNECTION_MODE'])) return true; if (isset($_SERVER['HTTP_X_UP_CALLING_LINE_ID'])) return true; if (strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"VND.…
来自:https://www.cnblogs.com/webenh/p/5621890.html 用手机访问PC端WWW域名的时候,自动判断跳转到移动端,用电脑访问M域名手机网站的时候,自动跳转到PC端,我们团队在开发erdaicms二代旅游CMS网站管理系统的时候(http://www.erdaicms.com),分别开发了PC端和手机端,需要实现,用手机访问PC端WWW域名的时候,自动判断跳转到移动端,用电脑访问M域名手机网站的时候,自动跳转到PC端,于是有了下面这个判断函数: /*移动端判…
C#方式: /// <summary> /// 是否手机访问 /// </summary> /// <returns></returns> public static bool IsMobileBrowse() { string serverVariables = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]; return Regex.…
第一种:判断是手机访问还是PC访问 <script> function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var b…
最近项目中用到一个应用,当访问同一个网站地址的时候,例如:www.xxx.com的时候,如果当前客户端是pc则跳转到专注于pc的部分,如果当前客户机是手机,则跳转到专注于手机的部分,秉承一贯的习惯,baidu or google,但发觉网上的解决办法都不尽如人意,很多都是通过js读取本地文件系统进行判断,但经过测试,不能成功,而且通过js读取本地文件系统会造成安全性问题,但作为开放的互联网,我们不可能为每一部电脑设置安全性,于是自己动手,丰衣足食,以下就是我的解决办法:   依然是用js,不过只…
<!-- 2017/09/13 跳转手机页面 start by 小鬼PSer --> <meta name="mobile-agent" content="format=html5;url=http://forbag.inrn.net/kh1m.aspx"> <script type="text/javascript"> var userAgentInfo = navigator.userAgent; if (…
<script type="text/javascript"> if (window.location.toString().indexOf('pref=padindex') != -1) { } else { if (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || ( /MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|H…
想要适配手机端和pc端,有几种简单的方法,本人使用的是百分比分配的方法. *{ padding: 0; margin: 0; } body,html{ width: 100%; height: 100%; overflow: hidden; } #bottom_box{ width: 100%; height: 50px; background-color: #eee; display: flex; //这是flex布局,父元素设置为flex,子元素设置几等份就是分成几等份 position:…