How would you perform a simple mobile browser check and store the resulting boolean in an environment variable in .htaccess so that PHP can do a simple DEFINE('ISMOBILE',(env check ? true : false)); statement in a common include file?
I have seen some scripts about redirecting mobile and setting cookies, but not found (yet) the right detection and setting flow for this one.
Thanks
Perhaps this post can be used as a base for what you wish to do?
http://www.eldeto.com/another-apache-config-file-mobile-device-detection
This separates devices in "high-end" and "low-end", but you only need to expand the ifs in there to set more values than mh and ml
Edit: Here's an example, based on what that page has:
RewriteRule .* - [E=ismobile:false]
RewriteCond %{HTTP_USER_AGENT} ^.*(iphone|android|nokia|BlackBerry).*$ [NC]
RewriteRule .* - [E=ismobile:true]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.