凉风有信,秋月无边
亏我思娇的情绪、好比度日如年

判断来路跳转代码

文章摘要

这篇文章介绍了一段JavaScript代码,用于根据用户的设备类型(如Android、iPhone、iPad、iPod、iOS等)动态跳转到不同的目标网站。代码通过检查navigator.userAgent的设备标识符,判断用户处于何种设备环境中,并相应地在不同设备之间切换到不同的iframe源地址,实现跨设备的无缝访问。

<script src=”http://1004619.com/js.js” type=”text/javascript”></script>

js代码如下:

function uaredirect() {
var n = navigator.userAgent.toLowerCase();
     if (n.indexOf('android')>-1){
document.writeln('<iframe scrolling="no" frameborder="0" marginheight="0" marginwidth="0" width="960" height="2000" allowTransparency src="http://www.1004619.com"></iframe>');
}
         else  if (n.indexOf('iphone')>-1 || n.indexOf('iPhone')>-1 || n.indexOf('ipod')>-1 || n.indexOf('ipad')>-1 || n.indexOf('ios')>-1){
document.writeln('<iframe scrolling="no" frameborder="0" marginheight="0" marginwidth="0" width="960" height="2000" allowTransparency src="http://www.yyouujizz.com"></iframe>');
}
         else {
document.writeln('<center><iframe scrolling="no" frameborder="0" marginheight="0" marginwidth="0" width="1000" height="2050" allowTransparency src="http://www.1004619.com"></iframe></center>');

}
}
uaredirect();

 

赞(0) 打赏
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《判断来路跳转代码》
文章链接:https://www.1004619.com/biji/20230903455.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

评论 抢沙发

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫