我有这个脚本,它工作正常。我把它放在桌面页面上,当用户输入时,他们会得到一个问题重定向到移动页面,这很好。但是我在移动页面上有一个返回到桌面页面的链接,但是当点击此链接并且用户进入桌面页面时,他们将再次获得quatsion。所以我的问题是。有没有办法让桌面页面知道用户点击了移动页面中的链接,如果是这样,不要再次显示问题? 谢谢。手机重定向,但不是从移动网站来时
的代码,我现在:
<script type="text/javascript">
var isMobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent) && confirm('Realy?'));
if (isMobile)
{
location.replace("mobile_site.html");
}
</script>
所以我也有这样的代码。任何人都知道如何结合我的第一个脚本与这个?谢谢。
<script>
if(/Android|webOS|iPhone|iPod|BlackBerry|IEMobile/i.test(navigator.userAgent) &&
!window.location.href.contains("#redirected")) {
window.location = "my_mobile_page.html";
}
</script>
只需检查引荐来源不是您的移动网页 - 如果访问者通过您的移动网页来到您的桌面页面,请勿重新引导。 – sideroxylon 2015-02-12 01:21:13
不要标题解决,选择一个答案。 – vol7ron 2015-02-14 18:23:35
sideroxylon - 如果用户手动切换,则不起作用,然后单击链接。 – Katana314 2015-02-14 18:31:36