共用方式為


Gmail Impressions

I just came around to getting a Gmail account today. The novel concept appeals to me because I no longer have to use rules to filter email into folders - I simply use filters to produce various views of the same underlying email collection and use the star to notate really important email. Interestingly, it is actually very similar to how I use Outlook 2003 - I use "unread" and Flags to notate important email, and then I watch a few defined search folders for interesting email. Anyway, I will have to give Gmail a couple more weeks before I decide whether it is better or not.

However, one technical detail about Gmail (and Google Maps) really bothers me. For some reason, Gmail and Google Maps insist on instantiating an unused ActiveX control if it detects Internet Explorer as the browser, but it does no such thing on Firefox. Furthermore, the rest of the application does not appear to use ActiveX at all - just the initial detection page.

For example, the following content is the parent frame of Gmail that I get in both Firefox and Internet Explorer (I only altered whitespace characters from the original data to improve spacing and indentation for better legibility, as well as steal colorization from Firefox).

 <html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>Gmail</title>
<link rel="alternate" type="application/atom+xml" 
      title="Gmail Atom Feed" href="https://gmail.google.com/gmail/feed/atom" />
<script src="/gmail?view=page&name=browser&ver=c8a6d52b70776344">
</script>
</head>
<noscript>
<font face=arial>JavaScript must be enabled in order for you to use Gmail in standard view. 
However, it seems JavaScript is either disabled or not supported by your browser. To use 
standard view, enable JavaScript by changing your browser options, then 
<a href="/gmail">try again</a>. 
<p>To use Gmail's basic HTML view, which does not require JavaScript, 
<a href="/gmail?ui=html&zy=n">click here</a>.</p></font>
</noscript>
<script>
<!--
var fs_time = (new Date()).getTime();
function wfs() 
{
    if (top.location.href.indexOf('nocheckbrowser') != -1) 
    {
        return true;
    }
    
    if (!is_browser_supported) 
    {
        top.location = '/gmail?ui=html&zy=j';
        return false;
    }
    
    var testcookie = 'jscookietest=valid';
    document.cookie = testcookie;
    
    if (document.cookie.indexOf(testcookie) == -1) 
    {
        top.location = '/gmail/html/nocookies.html';
        return false;
    }
    
    document.cookie = testcookie + ';
    expires=' + new Date(0).toGMTString();
    var agt = navigator.userAgent.toLowerCase();
    
    if (agt.indexOf('msie')!= -1 && document.all) 
    {
        eval(
            "var control = (agt.indexOf('msie 5') != -1) ? 
                            'Microsoft.XMLHTTP' : 
                            'Msxml2.XMLHTTP';
             try
             {
                 new ActiveXObject(control);
             } 
             catch (e) 
             {
                 top.location = '/gmail/html/noactivex.html';
             }"
         );
    }
     
    return true;
}
 
if (wfs()) 
{
    document.write(
        "<frameset rows=\"100%,*\" border=0>
             <frame name=main src=/gmail/html/loading.html frameborder=0 noresize scrolling=no>
             <frame name=js src=/gmail?view=page&name=js frameborder=0 noresize>
         </frameset>"
    );
}
//-->
</script>
</html>

Notice that the Gmail parent frame intentionally isolates Internet Explorer's User Agent string and tries to instantiate various versions of the XMLHTTP control. It does not do anything with the control, but if it FAILS to instantiate the control, it redirects you to the "ActiveX must be enabled on IE" page.

I searched through the content of the child frames as well and found no need for ActiveX. In fact, I configured Internet Explorer to popup on any ActiveX use and browsed every single dialog, and Gmail only asked me that one time on initial load. So, as far as I can tell, Gmail and Google Maps do not use ActiveX anywhere other than the initial "test", which corroborates with the fact that these applications also run fine on Firefox without ActiveX.

So, the million dollar question in my mind remains. Why do these applications unnecessarily "require" ActiveX on Internet Explore if it is not used?

Do not misunderstand me - I am not anti-Google. I really admire web applications like Gmail, Google Maps, Google groups and the Google web-based newsreader (unlike Hotmail, MSN.com, and Microsoft's web-based newsreader) because they are elegantly simple, functional, and only require Javascript and DHTML. There is no hard ActiveX dependency.

When I use Internet Explorer, I unilaterally disable ActiveX behavior, so it bothers me that I have to alter my security settings just to get Gmail/Google Maps to work - and then to find out that these applications really do not need ActiveX.

Thus, I am more curious about improvements than anything else, and I hope that Gmail and Google Maps will remove the unnecessary ActiveX probe (or at least explain why it exists).

//David

Comments

  • Anonymous
    May 02, 2005
    Gmail used to be activeX only. So this probably is an (very bad sort of) artifact.

  • Anonymous
    May 02, 2005
    Isn't the ActiveX control being created in order to facilitate XmlHttp requests from Javascript? The FireFox implementation uses the native XmlHttpRequest object.

  • Anonymous
    May 03, 2005
    Hoo booy. Ignorance is your worst enemy. Go read up on DHTML, XmlHttpRequest object, and how it works, before posting nonsense like this. This hurts online reputation, both yours and your company's.

  • Anonymous
    May 03, 2005
    That ActiveX object is only CREATED once, it's used throughout gmail to download new bits of data from the server without having to reload the entire interface.. You should probably go have a look at the docs on MSDN before getting yourself all riled up about it.

  • Anonymous
    May 03, 2005
    Assuming the code shown here is right

    try {
    new ActiveXObject(control);
    }

    will create the object only. How can gmail use an object without storing it in a variable?

  • Anonymous
    May 03, 2005
    Hi Dan and Sinik,

    when we are only looking at the posted script there is definitely no sign that XmlHttp will or can be used later on as the created object is not stored in any variable.

    So before sending other people to rudely to the MSDN you might also double check your comments.

    Dan: it is impossible from that script that XmlHttp is created only once, like you stated. The "test instance" is not stored in a variable, so that instance is not usable.
    If it is used any time later it has to be created again. So this raises the question how that could be done without the mentioned ActiveX popup if David configured his IE like that.

    Comments on the comment are welcome,
    SvenC

  • Anonymous
    May 03, 2005
    SvenC:
    "If it is used any time later it has to be created again. So this raises the question how that could be done without the mentioned ActiveX popup if David configured his IE like that."

    As gmail creates new objects later IE must be using some kind of ask once (per object/site maybe) kinda thing.

  • Anonymous
    May 03, 2005
    Hi Bjoern,

    I created a little COM object to access the clipboard from within JavaScript because I wanted to check results of my dynamically changed html output, which is not viewable with View->Source. At least when I refreshed the page I was asked to allow using that COM object again.
    It might be that IE allows a COM object to be created again as long as no new GET or POST has been initiated. Then gmail could add some elements dynamically which create XmlHttp again and which doesn't show up in View->Source.

  • Anonymous
    October 28, 2005
    It seems to me that this is just a simple "detection" case to determine whether ActiveX is enabled or not. Much like they detect for supported browsers and that Javascript is enabled.

    IE versions earlier than 7 require ActiveX to be enable to use XmlHttpRequest which is used extensively by GMail.

  • Anonymous
    December 22, 2005
    two words: AJAX ATLAS

    hint* use google to find out what it is...

  • Anonymous
    December 16, 2007
    YOU DISCUSS DISCUSS DISCUSS !!! BUT NOBODY IS ABLE TO SHOW A SHORT PRECISE SOLUTION FOR THIS GMAIL PROBLEM : <font face=arial>JavaScript   ????????????????????????????????????????????????

  • Anonymous
    August 16, 2008
    XmlHttpRequest is an object that makes possible client-server communication. Invented by Microsoft, it is available as an ActiveX object in earlier versions of IE.. other browsers makes it available as a built in standard object. so therefore they can refer it as: new XmlHttpRequest thats why...

  • Anonymous
    August 17, 2008
    The comment has been removed