Quick Tip: Google Glass Web Browser User Agent
The XE7 update brought a built-in web browser for Google Glass, so it can now surf the web almost like any other mobile device. This means it has a user agent and you might need to know it, if you’re planning to target your website especially for Glass. For the moment, Google Glass’ browser is really simple and not very user friendly, so if you want your users to navigate your website with Google’s newest gadget, then you will have to create some special pages for it.
You can see the user agent below. If it changes in the meantime, we will update this article. Also, if you notice that it’s outdated, please let us know and we will update it ASAP.
Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Glass 1 Build/IMM76L; XE7) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
If you don’t know what a user agent is, I’m gonna explain it really quick. It’s a browser’s signature and every browser must have it. It contains information about the browser version and the web browser’s engine. Google Glass’ user agent also contains information about its operating system ( Android 4.0.4 ) and build ( Glass 1 Build ). Once Google officially releases Glass, that build will probably change, as the current build is probably the code for beta, its current stage.
In order to retrieve the user agent with PHP, you can use $_SERVER, an array created by the web server. More specifically, the information about the user agent is held in this variable $_SERVER['HTTP_USER_AGENT'];