Adobe Air HTML with Hotmail & Gmail

I finally managed to steal a bit of time to work on a small little intro project for Air. I have already made a couple of little apps, but I somehow didn't feel complete because I hadn't spun my own Air-based browser ... I think it might qualify as the "Hello World" for Air.

Anyway, having taken the 2 minutes needs to create a project, throw the HTML, TextInput and Button needed, I had a little browser going. Of course I started with Google because I live my life as a cliche, but I decided to see how well it worked with web based mail. I particularly remember having issues with Hotmail and Chrome when it first came out, but those seemed to have gone away - so how would my Air application behave?

Same issues as before. That is, I got an ominous warning about using a crappy browser, I couldn't resize panes, couldn't delete messages and probably other limitations I didn't experiment long enough to find. But Chrome worked, and I don't remember any major upgrades discussed - of course, google upgraders work in the background and don't seemed concerned with bothering to consult me. I also tried Gmail and Google was keen to let me know I was using a crappy browser as well.

And then a thought struck me. I quickly searched for a userAgent strings for Safari (figuring that the common webkit core should be close enough) and updated my HTML's userAgent property with some fancy cut-n-paste work.

Voila! Microsoft recognizes Safari as a bona fide browser so no more warnings, no more broken features. And Voila! Gmail now believes that I have a kosher browser. It seems tragic that over a decade ago in the world of Javascript it was discovered that capabilities testing is preferable to userAgent testing, but that these very large, widely utilized sites are squeezing out smaller browsers either by design, laziness or both.

While this is a workaround, it pretty much helps further break userAgent as a useful and viable environment variable. Shucks ...

For reference:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>
    <![CDATA[
        private function go():void {
            htmlBrowser.location = txtAddress.text;
        }
    ]]>

</mx:Script>

<mx:HTML id="htmlBrowser"
left="5" right="5" bottom="20" top="45"
locationChange="txtAddress.text=htmlBrowser.location"
userAgent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8" />


<mx:TextInput left="5" top="5" right="60" id="txtAddress" enter="go()"/>

<mx:Button label="GO!" right="5" top="5" width="45" paddingLeft="0" paddingRight="0" click="go()"/>
    
</mx:WindowedApplication>

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
katopz's Gravatar HUGE thx! it's work ;) test with my AIR toy here -> http://cutecoma.com/shironeko/
# Posted By katopz | 6/12/09 3:13 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.001. Contact Blog Owner