Ford Fleet – server-side sniffer

Problem: Opera can do its best to interpret the code that is sent to us, to be compatible with the standards and with other browsers BUT if the code we get is different from what the others get and plain inconsistent, we don't have any opportunity to displaying the page as the webmaster intended. Not the slightest.

Take, for example https://www.fleet.ford.com/default.asp

You will notice the overlapping content at once. A quick look at the source shows the following problem..

IE receives:

<div ID='contentdiv' class='contentIE'>

FireFox receives:

<div ID='contentdiv' class='contentNS'>

What Opera gets is:

<div ID='contentdiv' class=''>

Either what they send IE or what they send FF would work just fine. Opera falls between two chairs because the sniffer is intelligent enough to recognise it is neither of them but has no alternative content.

Advertisements

7 thoughts on “Ford Fleet – server-side sniffer

  1. Hi Hallvord,

    One thing that Opera should do, is allow us to modify useragent strings in javascript.

    If I inject this into the top of a page (in script tags obviously):

    navigator.userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Win32) [en]';
    navigator.appName = 'Microsoft Internet Explorer';
    navigator.appVersion = '4.0 (compatible; MSIE 6.0; Win32)';
    navigator.appCodeName = 'Mozilla';
    navigator.browserLanguage = 'en';
    navigator.systemLanguage = 'en';
    navigator.platform = 'Win32';

    Sadly, Opera fails to change these javascript variables most browser sniffers use. I think it should, both from the perspective of debugging these things and to empower the user to more effictively combat such stupid development practices in the first place.

    Do you know a way to force Opera to change these?

    (obviously window.opera etc needs to be manipulable to)

  2. Hi non-troppo,
    I really should link to your WIKI! I'll do that when I have a moment..

    Tested your idea a bit.. Just trying to change navigator.userAgent directly throws an error:

    name: DOMException
    message: NO_MODIFICATION_ALLOWED_ERR

    However, one is allowed to delete the entire navigator object and create another one. So:

    <script>
    delete window.opera;
    delete navigator;
    var navigator = new Object;
    navigator.userAgent='Mozilla/4.0 (compatible; MSIE 6.0; Win32) [en]';
    </script>

    Interesting approach. I usually use Proxomitron or similar tools to replace all instances of "Opera" in the code but this method may work too and sometimes be more convenient to apply.

  3. OK, I'll test this out using proxomitron – if it works this is BRILLIANT!

    This method is more lightweight than doing a global replace through a proxomitron filter I think.

  4. Here are the Proxomitron filters (they work great):

    FireFox:
    [Patterns]
    Name = "Fake: FireFox on All Sites"
    Active = TRUE
    URL = "$TYPE(htm)"
    Limit = 256
    Match = "<head1>"
    Replace = "<head1>
    "
    "<script type="text/javascript">
    "
    " delete window.opera; "
    " delete navigator; "
    " var navigator = new Object;
    "
    " navigator.userAgent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b) Gecko/20040415 Firefox/0.8.0+';
    "
    " navigator.appName = 'Netscape';
    "
    " navigator.appVersion = '5.0 (Windows; en-US)';
    "
    " navigator.appCodeName = 'Mozilla';
    "
    " navigator.vendor = 'FireFox';
    "
    " navigator.vendorSub = '0.8.0+';
    "
    " navigator.browserLanguage = 'en';
    "
    " navigator.systemLanguage = 'en';
    "
    " navigator.platform = 'Win32';
    "
    "</script>
    "
    "$STOP()"

    And the IE Filter:

    [Patterns]
    Name = "Fake: IE on All Sites"
    Active = FALSE
    URL = "$TYPE(htm)"
    Limit = 256
    Match = "<head1>"
    Replace = "<head1>
    "
    "<script type="text/javascript">
    "
    " delete window.opera; "
    " delete navigator; "
    " var navigator = new Object; "
    " navigator.userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Win32) [en]';
    "
    " navigator.appName = 'Microsoft Internet Explorer';
    "
    " navigator.appVersion = '4.0 (compatible; MSIE 6.0; Win32)';
    "
    " navigator.appCodeName = 'Mozilla';
    "
    " navigator.browserLanguage = 'en';
    "
    " navigator.systemLanguage = 'en';
    "
    " navigator.platform = 'Win32';
    "
    "</script>
    "
    "$STOP()"

  5. Sorry, the code got mangled, forgot about that. Can I input BBcode or HTML here?

    Forgot to say, some sniffers for FireFox use:

    navigator.vendor = 'FireFox';
    navigator.vendorSub = '0.8.0+';

    which I cannot get to work…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s