移动网站-如何切换到桌面版本
我有一个 WordPress 网站 (abetterworldbydesign.com),该网站具有用户代理检测功能,可将移动网站重定向到子目录。它正在使用插件:WPtap Mobile Detector
我想包含一个切换链接在移动版和桌面版之间切换。如何让网站记住移动用户已切换到桌面版本并避免再次将该用户重定向到移动版本?
I have a WordPress website (abetterworldbydesign.com) which has user-agent detection to redirect mobile websites to a subdirectory. It is using the plugin: WPtap Mobile Detector
I want to include a toggle link to switch between the mobile and desktop version. How can I make the site remember that a mobile user has switched to the desktop version and avoid redirecting that user to the mobile version again?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查 HTTP_REFERRER 是最简单的方法 - 没有 cookies &只需一张支票。
如果引荐来源网址位于您的域中 - 则不要重定向。
Checking the HTTP_REFERRER is the easiest method - no cookies & just one check.
If the referrer is on your domain - then don't redirect.
会话可能是最简单的,或者仍然检测移动设备,但附加了
?mobile=false
的 URL,以防止用户被重定向,但允许他们轻松返回移动网站。A session will probably be the easiest, or still detect mobile, but have a
?mobile=false
attached the URL that prevents the user from being redirected, but allows them to easily get back to the mobile site.