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= ...
 
随机推荐
- C# 运行时编辑 节点重命名
			
方法一: ; bool nodeChanged = false; //右键点击,就进入修改状态 private void treeView1_NodeMouseClick(object sender, ...
 - Vue.js学习 Item8 -- 方法与事件处理器
			
方法处理器 可以用 v-on 指令监听 DOM 事件: <div id="example"> <button v-on:click="greet&quo ...
 - MongoDB(1):常用操作命令大全
			
MongoDB常用操作命令大全(转) http://www.jb51.net/article/48217.htm 成功启动MongoDB后,再打开一个命令行窗口输入mongo,就可以进行数据库的一些操 ...
 - PHP 下载文件时自动添加bom头的方法
			
首先弄清楚,什么是bom头?在Windows下用记事本之类的程序将文本文件保存为UTF-8格式时,记事本会在文件头前面加上几个不可见的字符(EF BB BF),就是所谓的BOM(Byte order ...
 - php 购物车的例子
			
网上搜到的,简单容易理解.cookie存购物车ID,db存购物车数据. //购物车session的产生代码 1 if(! $session && ! $scid) { 2 / ...
 - Linux忘记密码的解救方法
			
Linux版本 centos5.6 64bit 环境 vmware 忘记密码 解决方法1: 重启系统, 一.重启系统,在系统引导前按任意键进入菜单.如图:GRUB: 在引导装载程序菜单上,用上下方向键 ...
 - delphi中的ClientDataSet组件的open和Execute方法各自在什么情况下用?
			
ClientDataSet组件本来是给midas用的,也是所谓的borland的三层数据技术,使用这个控件必须发行midas.dll挺麻烦的 open是通过应用的SQL语句为SELECTexecute ...
 - Mongodb的索引--学习笔记(未完)
			
全文索引 建立方法: --在articles集合的key字段上创建全文索引 db.articles.ensureIndex({key:"text"}) --在articles集合的 ...
 - xtrabackup之Innobackupex全备恢复
			
一.当前环境 [mysql@hadoop1 ~]$ mysql --defaults-/my.cnf -uroot -p123456 -P3306 mysql> show variables l ...
 - python 字符串格式化 (%操作符)
			
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 在许多编程语言中都包含有格式化字符串的功能,比如C和Fortran语言中的格式化输 ...