[英]Mobile redirect with full link to go to full site
我想也許可以通過一些步驟最終找到解決方案。 我有以下javascript指向移動網站。 而且效果很好。
<script type="text/javascript">
if ((navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)|(Windows Phone)|(BlackBerry)/i))) {
document.location = "http://www.c5mobile.com/drglenn/index.html";
}
(function(a,b) {
if (document.cookie.indexOf('fullsite') > -1) {
return; // skip redirect
}
if (location.search.indexOf('fullsite') > -1) {
document.cookie = 'fullsite=true; path=/;'
return; // skip redirect
}
})(navigator.userAgent || navigator.vendor || window.opera, 'http://www.c5mobile.com/drglenn/index.html')
</script>
但是在移動站點上,我想轉到完整站點,但是它一直循環播放。 這是下面使用的鏈接。
<a href="http://drdibart.com?fullsite=true">Full site</a>
有人對它為什么不斷循環回到移動網站有什么想法?
我認為添加此功能行不通?
if ( (navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)|(Windows Phone)|(BlackBerry)/i)) && location.search.indexOf('fullsite') < 0 ) {
document.location = "http://www.c5mobile.com/drglenn/index.html";
}
我只加了
&& location.search.indexOf('fullsite') < 0
作為if語句的第二個條件。 當前,重定向將首先在您的腳本的if語句中發生
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.