1. <script type="text/javascript">
  2. function GetRequest() {
  3. var url = location.search; //��ȡurl��"?"������ִ�
  4. var theRequest = new Object();
  5. if (url.indexOf("?") != -1) {
  6. var str = url.substr(1);
  7. strs = str.split("&");
  8. for(var i = 0; i < strs.length; i ++) {
  9. theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
  10. }
  11. }
  12. return theRequest;
  13. }
  14.  
  15. var request = new Object();
  16. request = GetRequest();
  17.  
  18. checkWidth();
  19.  
  20. function checkWidth() {
  21.  
  22. //if (undefined != request["Account"] && undefined != request["paihangbang"] && undefined != request["benlunmingci"] && undefined != request["tunshirenshu"] && undefined != request["benlunzuidatizhong"]) {
  23. // window.location.href = "share.html"+location.search;
  24. // return;
  25. //}
  26.  
  27. var math = Math.floor(Math.random()*10);
  28.  
  29. 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))){
  30. if(window.location.href.indexOf("?mobile")<0){
  31. try{
  32. if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
  33. }else if(/iPad/i.test(navigator.userAgent)){
  34. }else{
  35. }
  36.  
  37. if(undefined != request["Account"] && undefined != request["id"])
  38. {
  39. window.location.href = "index_mobile_share.html"+location.search;
  40. return;
  41. }else{
  42.  
  43. if(math <= 5){
  44. window.location.href="index_mobile.html"+location.search;
  45. return;
  46. }else{
  47. window.location.href="index_mobileA.html"+location.search;
  48. return;
  49. }
  50.  
  51. }
  52. }catch(e){}
  53. }
  54. }else{
  55. if(math <= 5){
  56. window.location.href="index_PC.html"+location.search;
  57. }else{
  58. window.location.href="index_PCA.html"+location.search;
  59. }
  60.  
  61. }
  62. }
  63.  
  64. </script>

  

js判断手机还是pc并跳转相关页面的更多相关文章

  1. js判断手机访问PC端跳转到手机站

    <script type="text/javascript">(function() { //得到域名后缀 var path = location.pathname.s ...

  2. js判断手机或Pc端登陆.并跳转到相应的页面

    <script src="~/Web/js/jquery-1.10.1.min.js"></script> <script> $(functio ...

  3. js判断手机访问web网站跳转到手机版

    第一种:直接JS脚本 <script type="text/javascript">try {var urlhash = window.location.hash;if ...

  4. js判断手机浏览器操作系统和微信浏览器的方法

    做手机端的前端开发,少不了对手机平台的判断.如,对于app下载,就要判断在Android平台下就显示Android下载提示:在iOS平台下就显示iOS下载提示. 今天就为大家介绍一下用js判断手机客户 ...

  5. js判断手机 横屏模式

    js判断手机 横屏模式 方法名称:orientation 实例: if(window.orientation!=0){ var obj=document.getElementById('orienta ...

  6. 如何利用JS判断当前来路域名并跳转到指定页面

    1.如何利用JS判断当前来路域名并跳转到指定页面 获取当前请求路径var href = location.href ;if(href.indexOf("baidu")>-1) ...

  7. JS实现手机访问pc网址自动跳转到wap网站

    之前写pc端直接跳转wap端一直是后端java写的,跟js一样都是根据navigator.userAgent来判断设备是电脑还是手机的,我知道这种前端也可已完成的功能,只是后台比较强势,本人本着以和为 ...

  8. js判断手机是否安装了某一款app,有则打开,没有去下载

    function openApp(){ if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { var loadDateTime = new ...

  9. js判断手机的横竖屏调整样式

    在移动端,我们经常遇到横竖屏的问题,所以我们改如何判断或针对横竖屏来写代码呢.首先需要在head中加入如下代码: <meta name="viewport" content= ...

随机推荐

  1. 第一部分 CLR基础:第3章 共享程序集和强命名程序集

    第一部分 CLR基础:第3章 共享程序集和强命名程序集

  2. Vue.js学习 Item8 -- 方法与事件处理器

    方法处理器 可以用 v-on 指令监听 DOM 事件: <div id="example"> <button v-on:click="greet&quo ...

  3. PHP 表单 - 验证邮件和URL

    PHP - 验证名称 以下代码将通过简单的方式来检测 name 字段是否包含字母和空格,如果 name 字段值不合法,将输出错误信息: $name = test_input($_POST[" ...

  4. 新浪SAE URLRewrite(伪静态、重定向)详解

    SAE全称Sina App Engine,真是一个好东西,他有很多优秀的特性,简单来说SAE就是一个简单高效的分布式Web服务开发.运行平台.支持现在常用的 PHP+Mysql 环境,在开发中难免会碰 ...

  5. PHP加密解密函数

    <?php/***功能:对字符串进行加密处理*参数一:需要加密的内容*参数二:密钥*/function passport_encrypt($str,$key){ //加密函数 srand((do ...

  6. mybatis动态sql中的trim标签的使用(转)

    trim标记是一个格式化的标记,可以完成set或者是where标记的功能,如下代码: 1. select * from user <trim prefix="WHERE" p ...

  7. 种树 (codevs 1653) 题解

    [问题描述] 一条街的一边有几座房子.因为环保原因居民想要在路边种些树.路边的地区被分割成块,并被编号为1..n.每个块大小为一个单位尺寸并最多可种一棵树.每个居民想在门前种些树并指定了三个号码b,e ...

  8. Android无法连接adb的解决方法

    今天在折腾乐蛙时发现无法链接ADB了,但是手机却显示USB调试模式! 然后想起了大蛋曾经告诉我CM的解决方法,于是你懂得,俺差点就把菊花给卖了呢(/Д`)~゚。 adb shell rm -r /da ...

  9. rails笔记

    rake -T 列出全部taskconfig.active_record.schema_format = :sql #remove the old db/schema.rb file, create ...

  10. Outlook打不开? 进程一大堆!

    问题描述: ====== 关闭Outlook应用程序后,Outlook.exe进程仍在任务管理器里继续运行,不能关闭. 原因: ====== Outlook的插件或者扩展程序阻止Outlook关闭 解 ...