判断pc还是手机打开跳转到别的网页
function is_mobile() {
var regex_match = /(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220)/i;
var u = navigator.userAgent;
if (null == u) {
return true;
}
var result = regex_match.exec(u); if (null == result) {
return false
} else {
return true
}
}
if (is_mobile()) {
document.location.href= 'http://3g.xftz.cn/wpwin/?from=singlemessage&isappinstalled=0';
}
判断pc还是手机打开跳转到别的网页的更多相关文章
- PC端手机访问跳转手机站点
第一种: var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.sr ...
- Js~动态判断PC和手机浏览器
这个只是一个小知识,也是在网上找的,挺好用! 动态判断浏览器是PC还是移动端! <script> var browser={ versions:function(){ var u = na ...
- js 判断pc与手机
var u = navigator.userAgent; if ((u.indexOf('Mac') > -1 || u.indexOf('Windows') > -1) &&am ...
- ASP.NET判断是否为手机登录
protected void Page_Load(object sender, EventArgs e) { MobileHandle(); } 页面加载时候判断是否为手机登录 protected v ...
- js判断页面是pc打开还是手机打开
<script type="text/javascript"> function browserRedirect() { var sUserAgent = naviga ...
- apache通过.htaccess(rewrite)判断手机电脑跳转-手机用户重定向到手机版
自动判断.重定向的办法也有几种: 使用网站构建的程序(例如PHP)来判断.重定向:使用服务器上的Web服务(例如Apache)来判断.重定向. 在Apache中设置重定向有两个办法: 在网站的http ...
- js判断PC端与移动端跳转
在网上看到很多这样类似的代码,但是有的很复杂,或者有的没有判断完全,上次经理去见完客户回来讲,使用苹果浏览打开pc端(pc已经做了识别跳转)会自动跳转到移动端的网页去,后来经测试才发现 documen ...
- 根据判断PC浏览器类型和手机屏幕像素自动调用不同CSS的代码
1.媒体查询方法在 css 里面这样写 -------------------- @media screen and (min-width: 320px) and (max-width: 480px) ...
- JS判断登陆端是PC还是手机
前些天朋友问我怎么判断登陆端是PC还是手机...自己也是很困惑,然后自己查了资料,这些东西都藏在USER-AGENT里面,查了他的一些属性,写了一个简单的验证页面大家共同学习. 读取navigator ...
随机推荐
- libvirt笔记(未完待续)
参考源地址:http://libvirt.org/formatdomain.html http://blog.csdn.net/qq250941970/article/details/6022094 ...
- yarn 无法下载node-sass
指定node-sass的下载源 yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
- tp5简单构造
application 应用目录 网站核心index前台目录 controller 控制器admin 后台目录 model 数据模型view 视图extend 静态类库目录public 静态资源和入口 ...
- Hive学习路线图
- sql语句(Oracle和sqlserver)
查询表的首句:(Oracle) select * from (select a.*, rownum as rn from tab_name a order by col )where rn = 1 o ...
- 笔记-python操作mysql
笔记-python操作mysql 1. 开始 1.1. 环境准备-mysql create database db_python; use db_python; create tabl ...
- 十、mysql之索引原理与慢查询优化
mysql之索引原理与慢查询优化 一.介绍 1.什么是索引? 一般的应用系统,读写比例在10:1左右,而且插入操作和一般的更新操作很少出现性能问题,在生产环境中,我们遇到最多的,也是最容易出问题的,还 ...
- Android 打印方法调用堆栈
RuntimeException here = new RuntimeException("here"); here.fillInStackTrace(); Log.w(" ...
- python基础----ipython快捷键
Standard Ipython keyboard shortcut • Ctrl -C interrupt currently-executing code • Ctrl- U Discard al ...
- 【NOIP 2017 提高组】列队
题目 有一个 \(n\times m\) 的方阵,每次出来一个人后向左看齐,向前看齐,询问每次出来的人的编号. \(n\le 3\times 10^5\) 分析 我们考虑离队本质上只有两种操作: 删除 ...