Detecting Pocket IE Using JavaScript
Feb 26
I recently read that Pocket IE for Windows Mobile supports JavaScript 1.5. This came as a complete suprise. For some reason I thought it would be far behind its desktop counterpart. At some point I’m going to test the DOM support as well.
I decided to do a bit of testing to see what it would take to do some simple browser detection. I’m not talking about detecting different desktop browser versions, but detecting Pocket IE. The key is to tie into JavaScript’s navigator object to grab the necessary information. In this case it’s called userAgent. The user agent is sent by the browser with each request to a web page. You can see the actual user agent entry from my log file below:
68.88.69.133 – - [26/Feb/2006:19:18:38 -0600] “GET / HTTP/1.1″ 302 3 “-” “HTC-8100/1.2 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; PPC; 240×320)”
This entry was created by my new Cingular 8125. So I wanted to take this a little further and see what JavaScript’s navigator object would return when accessing it from my 8125, which runs Pocket IE. I just wrote a simple function that enumerates the navigator object and prints it on a page. Well it wasn’t really a function since I couldn’t get Pocket IE to behave the way I wanted. I ended up writing the script directly in the page:
Feel free to access the page here:
http://www.db75.com/dev/mobile/user_agent.html
In Safari this yields the following output:
appCodeName: Mozilla
appName: Netscape
appVersion: 5.0 (Macintosh; en-US)
language: en-US
mimeTypes: [object MimeTypeArray]
platform: MacPPC
oscpu: PPC Mac OS X Mach-O
vendor: Firefox
vendorSub: 1.0.1
product: Gecko
productSub: 20050225
plugins: [object PluginArray]
securityPolicy:
userAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1
cookieEnabled: true
javaEnabled: function javaEnabled() { [native code] }
taintEnabled: function taintEnabled() { [native code] }
preference: function preference() { [native code] }
While in Pocket IE only a subset of this is listed:
appCodeName: HTC-8100
appName: Microsoft Pocket Internet Explorer
appVersion: 1.2 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; PPC; 240×320)
userAgent: HTC-8100/1.2 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; PPC; 240×320)
platform: WinCE
Notice the difference in the userAgent properties, which is what we normally use to do browser detection. This can be something as simple as navigator.userAgent.toLowerCase().indexOf(“windows ce”); to check for a Windows enabled mobile device. Obviously the detection can be made more robust, but the point is accessing the userAgent string and performing your logic on that.
The mobile browser has come a long way and it’s exciting to see such extensive support for JavaScript on these devices. It will enable developers to do exciting things and push the limits of mobile web applications. If you’re interested in one of the best references for JavaScript then I highly recommend the book below.


Please note that the ODM has modified this string. You will not normally see HTC-8100 as the appCodeName. It’s supposed to be Mozilla.
You are correct, the best way to detect PocketIE (aka IEMobile) is to check for “Windows CE” in the User-Agent string.
Stay tuned to our blog for more information on detecting Pocket IE/IEMobile.
Randy