js判断手机还是pc并跳转相关页面
<script type="text/javascript">
function GetRequest() {
var url = location.search; //��ȡurl��"?"������ִ�
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for(var i = 0; i < strs.length; i ++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest;
} var request = new Object();
request = GetRequest(); checkWidth(); function checkWidth() { //if (undefined != request["Account"] && undefined != request["paihangbang"] && undefined != request["benlunmingci"] && undefined != request["tunshirenshu"] && undefined != request["benlunzuidatizhong"]) {
// window.location.href = "share.html"+location.search;
// return;
//} var math = Math.floor(Math.random()*10); if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){
if(window.location.href.indexOf("?mobile")<0){
try{
if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
}else if(/iPad/i.test(navigator.userAgent)){
}else{
} if(undefined != request["Account"] && undefined != request["id"])
{
window.location.href = "index_mobile_share.html"+location.search;
return;
}else{ if(math <= 5){
window.location.href="index_mobile.html"+location.search;
return;
}else{
window.location.href="index_mobileA.html"+location.search;
return;
} }
}catch(e){}
}
}else{
if(math <= 5){
window.location.href="index_PC.html"+location.search;
}else{
window.location.href="index_PCA.html"+location.search;
} }
} </script>
js判断手机还是pc并跳转相关页面的更多相关文章
- js判断手机访问PC端跳转到手机站
<script type="text/javascript">(function() { //得到域名后缀 var path = location.pathname.s ...
- js判断手机或Pc端登陆.并跳转到相应的页面
<script src="~/Web/js/jquery-1.10.1.min.js"></script> <script> $(functio ...
- js判断手机访问web网站跳转到手机版
第一种:直接JS脚本 <script type="text/javascript">try {var urlhash = window.location.hash;if ...
- js判断手机浏览器操作系统和微信浏览器的方法
做手机端的前端开发,少不了对手机平台的判断.如,对于app下载,就要判断在Android平台下就显示Android下载提示:在iOS平台下就显示iOS下载提示. 今天就为大家介绍一下用js判断手机客户 ...
- js判断手机 横屏模式
js判断手机 横屏模式 方法名称:orientation 实例: if(window.orientation!=0){ var obj=document.getElementById('orienta ...
- 如何利用JS判断当前来路域名并跳转到指定页面
1.如何利用JS判断当前来路域名并跳转到指定页面 获取当前请求路径var href = location.href ;if(href.indexOf("baidu")>-1) ...
- JS实现手机访问pc网址自动跳转到wap网站
之前写pc端直接跳转wap端一直是后端java写的,跟js一样都是根据navigator.userAgent来判断设备是电脑还是手机的,我知道这种前端也可已完成的功能,只是后台比较强势,本人本着以和为 ...
- js判断手机是否安装了某一款app,有则打开,没有去下载
function openApp(){ if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { var loadDateTime = new ...
- js判断手机的横竖屏调整样式
在移动端,我们经常遇到横竖屏的问题,所以我们改如何判断或针对横竖屏来写代码呢.首先需要在head中加入如下代码: <meta name="viewport" content= ...
随机推荐
- asp.net中分页与存储过程的一些总结
一.接上文,使用的是jquery AJAX 进行分页 分页存储过程代码如下: ALTER PROCEDURE [dbo].[USP_GetAlbumByPage] @pageIndex int,--当 ...
- css半透明
filter:alpha(opacity=80); /*支持 IE 浏览器*/-moz-opacity:0.80; /*支持 FireFox 浏览器*/opacity:0.80; /*支持 Chrom ...
- ViewPage显示Fragment集合实现左右滑动并且出现tab栏--第三方开源--SlidingTabLayout和SlidingTabStrip实现
注意:有关Fragment的方法和ViewPager的全部是android.support.v4包的,否则会报很多的错误 MainActivity: package com.zzw.fragmentt ...
- SHOW SLAVE STATUS几个常见参数
--显示当前读取的Master节点二进制日志文件和文件位置,对应线程I/O thread Master_Log_File: mysql-bin.000011 Read_Master_Log_Pos: ...
- [terry笔记]dblink
dblink在分布式数据库集群中很常见,今天简单的总结一下. db link 的命名和global_names有关,global_name是数据库全局名称,global_name在你所管理的数据库中要 ...
- 第一个MySQL 存储过程
昨天写了人生第一个mysql存储过程:遗憾的是,这个存储过程最后还是没用上,用php代码替代 话说mysql的存储过程真是反人类,不查reference,基本不能看懂那些语句:语言中能和它相比的,只有 ...
- 【转】IT领域技能图谱
- ZygoteInit 相关分析
上一篇文章我们已经分析到调用com.android.internal.os.ZygoteInit类的main函数. 今天分析一下com.android.internal.os.ZygoteInit类的 ...
- hdu 1702 ACboy needs your help again!
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1702 ACboy needs your help again! Description ACboy w ...
- 在 Ubuntu 13.10 中搭建Java开发环境 - 懒人版
本文记录我在Ubuntu 13.10中搭建Java开发环境. 本文环境: Ubuntu 13.10 x64运行在Win7下的VMware Workstation 10中. 1. 安装JDK与JRE s ...