如果我有重定向,如何让移动用户查看我网站的非移动版本?

发布于 2024-10-10 02:18:12 字数 288 浏览 0 评论 0原文

利用 http://detectmobilebrowser.com/ 上找到的经典 ASP 代码,我可以将移动浏览器自动重定向到更多内容我的网站的精益和优化的移动版本。

但是,如果移动用户更愿意查看完整的网站,我可以在页脚中提供一个链接,将他们带到那里。不幸的是,当他们返回主站点时,移动检测脚本会启动并再次重定向他们。

我该如何阻止这种情况发生?我的第一个想法是使用 cookie,但我不熟悉所涉及的过程。

Utilizing the classic ASP code found on http://detectmobilebrowser.com/ I have mobile browsers being automatically redirected to the much more lean and optimized mobile version of my site.

However, if a mobile user would rather view the full site, I have a link in the footer to take them there. Unfortunately, when they go back to the main site the mobile detect script kicks in and redirects them again.

How do I stop this from happening? My first thought was using a cookie, but I'm not familiar with the process involved.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

哽咽笑 2024-10-17 02:18:19

在移动登陆页面上,当用户单击“继续访问桌面”链接时,服务器会设置一个 cookie 来标记用户想要查看桌面站点。然后,对于所有请求,如果 cookie 存在,服务器就会让请求发送到桌面站点。否则重定向到移动网站。

示例代码在这里:
http://msdn.microsoft.com/en-us/magazine/jj553508.aspx

On the mobile landing page, when the user clicks "continue to the desktop" link, the server set a cookie to flag the user wants to see the desktop site. Then for all the request, if the cookie is there, the server just let the request go the the desktop site. Otherwise redirect to the mobile site.

Sample code is here:
http://msdn.microsoft.com/en-us/magazine/jj553508.aspx

落在眉间の轻吻 2024-10-17 02:18:17

我使用查询字符串(例如default.asp?redirect=0)执行此操作,然后使用if-else,我仅在没有redirect=0时运行deection脚本

i do it with query string such as default.asp?redirect=0 then with if-else i only run dedection script when there is no redirect=0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文