Partager via


User Agent String Documentation

One of the purposes of releasing the IE7 beta is to collect feedback on compatibility with both websites and extensions and we continue to look at all the reports we receive of sites and applications not working. There are reasons for this such as the base tag change that we blogged about recently and also bugs that we are detecting that you’ll see addressed later in the project cycle. However the most common issue we continue to see for web sites not working are that they are blocking access or serving the wrong content as a result of the new User Agent string for IE7. I’ve seen some websites that when visited using IE7 ask the user to upgrade to the latest version of Internet Explorer or Netscape and other websites that serve content with very small fonts. Sometimes even some Microsoft’s own websites have been blocking access! A user can work around an incompatible website by adjusting the User-Agent string as described in a previous blog post. We now also have some additional documentation on MSDN to help:

I want to be clear that we do not advocate blocking access to content based on the User Agent string of the browser, as this practice results in users of unknown and newer versions of browsers being locked out. Rather than blocking unknown user-agents, consider using user-agent sniffing only in isolated cases to work around known limitations of specific user-agents.

Thanks,

- Dave

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Without the user agent string, browser usage stats become obsolete.

  • Anonymous
    January 01, 2003
    User Agents are necessary for seeing who uses what, especially with Firefox bug tracking. It's the Javascript that sniffs it that should be outlawed :)

  • Anonymous
    January 01, 2003
    One of the reasons why some sites are having problems with the new User Agent string is because of the version number. The 7.0b designation can cause problems if the developer expects that value to always be numerical. The failure to parse "7.0b" can, of course, cause the web app to return a page intended for users of legacy browsers.

  • Anonymous
    January 01, 2003
    I use something like this:

    function runningInJScript() {
    var e = new Error(1234, 'TestAMessage');
    if ( (e.number != 1234)
    || (e.description === undefined)
    || (e.message!='TestAMessage') ) {
    return false;
    }
    return true;
    }

    If I recall correctly only Microsoft browsers (starting with IE5) will make this function return true.

    More fun with JScript and ECMA-262 non-compliance:
    javascript: var e=Error(1234); alert(e.message)
    javascript: var e=Error('12345678901234567890'); alert(e.message); alert(e.number)

    The compliance issue could be fixed by always setting the message to the string value of the first arg excepted when there are 2 args with the first one being a number and the 2nd being a string.

  • Anonymous
    January 01, 2003
    Many of the web developers whom I met recently expressed thier main concern on Internet Exporer 7 as...

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    I think that if the web designer's done his job properly, there should be no need to employ browser sniffing on a site at all

    In the days of IE4 vs NN it was a total nightmare, and site development would take twice as long as it does now
    Now though I design for Mozilla and IE5.5, but always make sure there's a text option so at least others can read the content

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    We've put up some more documentation on MSDN regarding User Agent string and posted on the IE team blog...

  • Anonymous
    January 01, 2003
    We've put up some more documentation on MSDN regarding User Agent string and posted on the IE team blog...

  • Anonymous
    January 01, 2003
    On
    http://msdn.microsoft.com/library/?url=/workshop/author/dhtml/overview/aboutuseragent.asp
    you quote the following javascript method for showing the user agent:
    javascript:alert(navigator.userAgent)

    While that works, I find the following to be more useful because you can copy the useragent to your clipboard

    javascript:prompt('Your user agent is', navigator.userAgent); void(0);

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Eric, now that's a really useful tip. Thanks!

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    I just attended an online chat with members of the IE7 team and was allowed to share portions of it. Here are some interesting quotes which I just print here without any further judgement. Some of them are really interesting, some are encouraging, some ar

  • Anonymous
    January 01, 2003
    I don't agree with Browser sniffing at all.

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    <<I'd also like to see the ability to confirm a browser through a secondary method should the UA fail. You can turn off a useragent which REALLY does not help us (web designers/developers)>>

    You can still use either conditional comments or JScript's Navigator object to perform a user-agent test on the client side?

    << thus instead of blocking access completely (as I have on my site to blank UAs)>>

    As noted above, this is not recommended. Rather than blocking missing or unknown UAs, simply treat them as modern/uplevel. That way, if your content chokes a browser that doesn't identify itself, it's not your fault, it's the browser's fault. This will simplify your ongoing site maintenance and will ensure users of unknown or future browsers are not inconvenienced.

  • Anonymous
    January 01, 2003
    How would sites break if you removed that portion of the UA string?

    IE conditional comments would be an effective way to test for browsers claiming to or not to be IE.

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    In case you want to do browser sniffing without using JavaScript I've been keeping Microsoft's woefully out of date browscap.ini file updated for many years now.

    There is usually an updated download every Sunday.

    My file(s) include the popular browsers and user agents such as search engines, e-mail harvesters, media players and more.

  • Anonymous
    January 01, 2003
    Alberto,

    Great insight. I was partially playing devil's advocate with my initial post mostly out of exasperation. How many times must we go through this!?

    I couldn't agree more with you about inappropriate and/or frivolous DHTML. It's probably also true that eliminating the user agent string would do nothing to prevent it any more than eliminating the user agent string would improve the quality of DHTML code in general.

    I do believe that if more interface designers and developers were familiar with basic web usability concepts, they might resist some of the sizzle in exchange for more readily accessible steak. ;-)

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Where are you people visiting that blocks IE?

    I've seen any number of sites that block non-IE browsers, but none that block any version of IE.

    BTW: If you want to detect JScript, it's much faster and easier to use conditional compilation. Here's a script that will determine which rendering engine is used:

    <script type="text/jscript">
    /@cc_on @if(@_win32) document.write('Trident');
    @else document.write('Tasman'); @end @
    /
    </script>
    <script type="application/x-javascript">
    if(document.layers) document.write('Netscape4');
    else if(!window.clientInformation) document.write('Gecko');
    else if(!document.createProcessingInstruction) document.write('Presto');
    else if(document.compatMode=='CSS1Compat') document.write('Cab');
    else document.write('KHTML');
    </script>
    <noscript>unknown</noscript>

    From http://webcoder.info/reference/BrowserFiltering.html

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    December 23, 2007
    PingBack from http://internet-explorer-alternative.blogyblog.info/?p=267

  • Anonymous
    June 06, 2008
    PingBack from http://thought.mobiforumz.com/2005/09/02/ie7-beta-chat-transcript-from-today/

  • Anonymous
    July 10, 2008
    PingBack from http://winzenz.mobiforumz.com/2005/09/02/ie7-beta-chat-transcript-from-today/

  • Anonymous
    May 29, 2009
    PingBack from http://paidsurveyshub.info/story.php?title=ieblog-user-agent-string-documentation

  • Anonymous
    May 31, 2009
    PingBack from http://woodtvstand.info/story.php?id=8994