CODE

<script>
//判断终端url跳转
function sp_isMobile() {
return Boolean(navigator.userAgent.match(/.*(iphone|ipod|android|symbian|nokia|blackberry| rim |opera mini|opera mobi|windows ce|windows phone|up\.browser|netfront|palm-|palm os|pre\/|palmsource|avantogo|webos|hiptop|iris|kddi|kindle|lg-|lge|mot-|motorola|nintendo ds|nitro|playstation portable|samsung|sanyo|sprint|sonyericsson|symbian).*/i) || navigator.userAgent.match(/alcatel|audiovox|bird|coral|cricket|docomo|edl|huawei|htc|gt-|lava|lct|lg|lynx|mobile|lenovo|maui|micromax|mot|myphone|nec|nexian|nook|pantech|pg|polaris|ppc|sch|sec|spice|tianyu|ustarcom|utstarcom|videocon|vodafone|winwap|zte/i));
}
//移动端排除ipad
if(sp_isMobile()&&location.search.indexOf('pc=true')==-&&navigator.userAgent.indexOf('iPad')==-) {
//添加meta 方便移动端获取document.documentElement.clientWidth
document.write('<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />'); if(document.documentElement.clientWidth>){
location.href="http://www.xxxx.com/index.shtml?pc=true";
}else{
location.href="http://u.pa.com/upingan/upingan/index.html?mediasource=SC03-Direct-00002";
} }
</script>

js判断移动终端url跳转的更多相关文章

  1. JS判断设备终端(PC,iPad,iPhone,android,winPhone)和浏览器

    JS判断设备终端(PC,iPad,iPhone,android,winPhone)和浏览器 var ua = navigator.userAgent; var browser = {}, weixin ...

  2. js判断是否手机自动跳转移动端

    写法一: {literal} <script> //判断是否手机自动跳转 var browser={versions:function(){var u=navigator.userAgen ...

  3. js判断是否第一次访问跳转

    今天分享一套关于Js劫持代码,进行判断第一次访问进行跳转,仅供大家参考学习! 未加密: if (c.indexOf('isfirstvisited=false') != -1) { } else { ...

  4. js判断访问终端

    //判断访问终端 var browser={ versions:function(){ var u = navigator.userAgent, app = navigator.appVersion; ...

  5. jS判断浏览器终端

    在做移动端项目的时候,常常会遇到需要判断页面浏览终端的需求.要想判断是什么浏览器终端,先打印 navigator.userAgent 出来.所以收集了几种比较常用的方法: if(/(iPhone|iP ...

  6. js 判断访问终端类型

    // 判断访问终端类型 var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appV ...

  7. js判断移动终端(手机浏览器)

    方法1: <script type="text/javascript">         var browser = {             versions: f ...

  8. JS实现PC端URL跳转到对应移动端URL

    在做移动端网站时,有时因技术问题或其他原因无法制作响应式版面,而移动端页面只能放到子目录下,但是手机端通过搜索引擎进入网站电脑端子页面,无法匹配到移动端页面,使得用户体验很不好,即影响排名也影响转化. ...

  9. 判断是否发生url跳转

    url="https://www.baidu.com/" url='http://www.freebuf.com/fevents/133225.html' # 方法一:禁止跳转:a ...

随机推荐

  1. 在Dreamweaver中安装Emmet(zen-coding)

    在http://www.adobe.com/exchange/em_download/地址下下载好Emmet扩展插件,然后在Dreamweaver找到菜单栏中命令>扩展管理>文件,找到以后 ...

  2. Android开发环境搭建全程演示(jdk+eclipse+android sdk)

    全程演示android开发环境的搭建过程,无需配置环境变量.所有软件都是写该文章时最新版本 一 相关下载 (1) java JDK下载: 进入该网页: http://java.sun.com/java ...

  3. Arima拟合函数,se出现NaN问题

    R语言Arima函数拟合模型,se(标准误)出现NaN的问题. 参考了网上的资料,虽然不太明白是什么意思,但是这样的模型不能用. 参考:http://stackoverflow.com/questio ...

  4. gulp plugins 插件介绍

    目录 [−] gulp API gulp.src(globs[, options]) gulp.dest(path[, options]) gulp.task(name[, deps], fn) gu ...

  5. JS保留小数点(四舍五入、四舍六入)实例

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <hea ...

  6. ACM Same binary weight

    Same binary weight 时间限制:300 ms  |  内存限制:65535 KB 难度:3   描述 The binary weight of a positive  integer ...

  7. 一个动画 Label (走马观花)

    UILabel中一个水平移动的Label UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 300, 300)]; U ...

  8. 【BZOJ】3712: [PA2014]Fiolki

    http://www.lydsy.com/JudgeOnline/problem.php?id=3712 题意:n个瓶子,第i个瓶子里又g[i]克物质.m次操作,第i次操作把第a[i]个瓶子的东西全部 ...

  9. POJ 2420 A Star not a Tree?(模拟退火)

    题目链接 居然1Y了,以前写的模拟退火很靠谱啊. #include <cstdio> #include <cstring> #include <string> #i ...

  10. 使用C#将HTML文本转换为普通文本,去掉所有的Html标记(转)

    using System; using System.Collections.Generic; using System.Linq; using System.Text; //首先需要导入命名空间 u ...