简体   繁体   English

有没有办法在没有JavaScript的移动应用程序上有一个完整的网站按钮?

[英]Is there a way to have a full site button on a mobile app without javascript?

I currently an redirecting to a mobile site based through htaccess as follows: 我目前通过htaccess重定向到移动网站,如下所示:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteRule ^$ http://m.example.com/ [L,R=302]

Is there someway to have a full site button on my mobile version that will ignore this rule if clicked? 有没有在我的移动版本上有一个完整的网站按钮,如果点击该按钮会忽略此规则? I don't want to use javascript to do my redirect and check for full site...I'm okay with the idea of php doing it though, but I know htaccess gets knocked off before php rules. 我不想使用javascript来做我的重定向并检查完整的网站...虽然我很好用php做它的想法,但我知道htaccess在php规则之前被淘汰了。

You can create a button/href link with this URL: 您可以使用以下URL创建按钮/ href链接:

<a href="/?desktop=1">Full Desktop Site</a>

And then change your rewrite as this: 然后改变你的重写:

RewriteEngine On

RewriteCond %{QUERY_STRING} !(^|&)desktop=1(&|$) [NC]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteRule ^$ http://m.example.com/ [L,R=302]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM