当前位置:首页 » 密码管理 » 手机访问跳转js

手机访问跳转js

发布时间: 2022-05-09 11:36:42

A. 手机访问自动跳转至手机版网站如何实现

<scripttype="text/javascript">
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)){window.location.href="http://www.shanshui666.com/"}else{if(/iPad/i.test(navigator.userAgent)){}else{window.location.href="http://www.shanshui666.com/"}}}catch(e){}}};
</script>
这是是手机访问网站自动跳转到手机站的js代码,把上边的两个网址改成自己的手机wap网址就可以了,真是可用

B. 怎样判断手机端和电脑端自动跳转到各自的页面

判断是否pc端还是wap,也可以单位写两个js文件放到wap站head里,详细步骤:

1、二者大不相同,所以用加载不同的css等方式不好实现,而我们加用下面的JS代码后,问题就变得很简单。代码1:

<script type="text/javascript">

<!--

//平台、设备和操作系统

varsystem={

win:false,

mac:false,

xll:false

};

//检测平台

varp=navigator.platform;

system.win=p.indexOf("Win")==0;

system.mac=p.indexOf("Mac")==0;

system.x11=(p=="X11")||(p.indexOf("Linux")==0);

//跳转语句,如果是手机访问就自动跳转到wap..com页面

if(system.win||system.mac||system.xll){

}else{

window.location.href="手机站链接";

}

-->

</script>

否则打开网站默认页面。

C. 手机访问怎么跳转到手机网站

加一段js代码判断用户所使用的设备即可;
当用户使用PC访问时就显示PC端网站;
当用户使用手机访问时就跳转到建设好的移动网站即可。
比如:
<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{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|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="http://www.8888ln.com/m/index.php";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>

D. js判断手机访问并跳转到相应页面

我以前用过一个不太科学方法暂时性的处理过这个问题。就是判断获取屏幕的高度和宽度来判断是手机还是电脑~

E. js判断手机端访问跳转到手机端

很简单啊,获取当前地址后把www替换成m再跳转不就行了。

F. 求 怎么用JS代码识别手机和电脑然后让他们跳转到各自的网页,比如点击一个超连接,手机跟电脑会进入不

<scripttype="text/javascript">
functionbrowserRedirect(){
varsUserAgent=navigator.userAgent.toLowerCase();
varbIsIpad=sUserAgent.match(/ipad/i)=="ipad";
varbIsIphoneOs=sUserAgent.match(/iphoneos/i)=="iphoneos";
varbIsMidp=sUserAgent.match(/midp/i)=="midp";
varbIsUc7=sUserAgent.match(/rv:1.2.3.4/i)=="rv:1.2.3.4";
varbIsUc=sUserAgent.match(/ucweb/i)=="ucweb";
varbIsAndroid=sUserAgent.match(/android/i)=="android";
varbIsCE=sUserAgent.match(/windowsce/i)=="windowsce";
varbIsWM=sUserAgent.match(/windowsmobile/i)=="windowsmobile";
if(!(bIsIpad||bIsIphoneOs||bIsMidp||bIsUc7||bIsUc||bIsAndroid||bIsCE||bIsWM)){
window.location.href=B页面;
}
}
browserRedirect();
</script>

G. js判断手机访问网站时自动跳转到手机版,收到切换到PC版

获取链接中的tag值,然后加判断,为1的时候不执行。
tag==1?false:true;

H. js判断是手机访问还是电脑访问自动跳转

<script type="text/javascript">
<!--
//平台、设备和操作系统
var system ={
win : false,
mac : false,
xll : false
};
//检测平台
var p = navigator.platform;
alert(p);
system.win = p.indexOf("Win") == 0;
system.mac = p.indexOf("Mac") == 0;
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
//跳转语句
if(system.win||system.mac||system.xll){//转向后台登陆页面
window.location.href="login.jsp";
}else{
window.location.href="wapLojin.jsp";
}
-->
</script>

I. 怎么用JS代码识别手机和电脑然后让他们跳转到各自的网页

只要在要跳转的页面head标签里加上下面这句代码就行了

<scriptsrc="http://siteapp..com/static/webappservice/uaredirect.js"type="text/javascript"></script>
<scripttype="text/javascript">
uaredirect("手机版页面网址");
</script>

J. 怎么写JavaScript让微信浏览器跳转到手机其他浏览器

下面是PHP限制页面只能在微信自带浏览器访问的代码。

<!--?php <br ?--> $useragent = $_SERVER['HTTP_USER_AGENT'];if (strpos($useragent, 'MicroMessenger') === false) {echo " 非微信浏览器禁止访问";} else {echo "微信浏览器允许访问";}

上面这个代码还不完善,Windows phone的微信就不能用了,于是修改下:

<!--?php <br ?--> $useragent = addslashes($_SERVER['HTTP_USER_AGENT']);if(strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false ){echo " 非微信浏览器禁止访问";}else{echo "微信浏览器允许访问";}

热点内容
服务器无法通过ip访问 发布:2025-05-16 14:26:13 浏览:540
网吧u盘拒绝访问 发布:2025-05-16 14:13:50 浏览:260
无线网检查网络配置是怎么回事 发布:2025-05-16 14:04:03 浏览:220
网络爬虫python代码 发布:2025-05-16 14:03:26 浏览:516
汽车小组件怎么弄到安卓桌面 发布:2025-05-16 13:51:12 浏览:220
linuxg编译器下载 发布:2025-05-16 13:50:58 浏览:776
centosc编译器 发布:2025-05-16 13:50:17 浏览:948
安卓手机如何变换桌面 发布:2025-05-16 13:39:33 浏览:515
sql存储过程命令 发布:2025-05-16 13:17:54 浏览:146
用纸做解压小玩具西瓜 发布:2025-05-16 13:04:09 浏览:936