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= ...
随机推荐
- 第一部分 CLR基础:第3章 共享程序集和强命名程序集
第一部分 CLR基础:第3章 共享程序集和强命名程序集
- Vue.js学习 Item8 -- 方法与事件处理器
方法处理器 可以用 v-on 指令监听 DOM 事件: <div id="example"> <button v-on:click="greet&quo ...
- PHP 表单 - 验证邮件和URL
PHP - 验证名称 以下代码将通过简单的方式来检测 name 字段是否包含字母和空格,如果 name 字段值不合法,将输出错误信息: $name = test_input($_POST[" ...
- 新浪SAE URLRewrite(伪静态、重定向)详解
SAE全称Sina App Engine,真是一个好东西,他有很多优秀的特性,简单来说SAE就是一个简单高效的分布式Web服务开发.运行平台.支持现在常用的 PHP+Mysql 环境,在开发中难免会碰 ...
- PHP加密解密函数
<?php/***功能:对字符串进行加密处理*参数一:需要加密的内容*参数二:密钥*/function passport_encrypt($str,$key){ //加密函数 srand((do ...
- mybatis动态sql中的trim标签的使用(转)
trim标记是一个格式化的标记,可以完成set或者是where标记的功能,如下代码: 1. select * from user <trim prefix="WHERE" p ...
- 种树 (codevs 1653) 题解
[问题描述] 一条街的一边有几座房子.因为环保原因居民想要在路边种些树.路边的地区被分割成块,并被编号为1..n.每个块大小为一个单位尺寸并最多可种一棵树.每个居民想在门前种些树并指定了三个号码b,e ...
- Android无法连接adb的解决方法
今天在折腾乐蛙时发现无法链接ADB了,但是手机却显示USB调试模式! 然后想起了大蛋曾经告诉我CM的解决方法,于是你懂得,俺差点就把菊花给卖了呢(/Д`)~゚。 adb shell rm -r /da ...
- rails笔记
rake -T 列出全部taskconfig.active_record.schema_format = :sql #remove the old db/schema.rb file, create ...
- Outlook打不开? 进程一大堆!
问题描述: ====== 关闭Outlook应用程序后,Outlook.exe进程仍在任务管理器里继续运行,不能关闭. 原因: ====== Outlook的插件或者扩展程序阻止Outlook关闭 解 ...