Skip navigation.

Broken DPI Licensing Site

, , ,

I'm quite convinced now that the web is built almost exclusively by people who have no idea what they're doing. They plug away with some random code, poking and prodding until it works in whatever browser they happen to be using (usually some recent version of Internet Explorer).

Take for example my local government Department of Planning and Infrastructure. They have a Licensing service where you can pay your license fees online. Clicking the "Pay online here" link at the top right takes you to a page with a simple "Go to online payments" button. Clicking that button in Opera takes you to a 404 page, while in IE and Firefox you see the correct payments page.

Another Opera bug? Hardly. Here's the relevant code in full:
function snif() {
  var fullAppStr=navigator.appName;
  var fullVerStr=navigator.appVersion;
  var mac = fullAppStr.indexOf("acintosh");
  var msie = fullAppStr.indexOf("icrosoft");
  var verStr = fullVerStr;                
  if (fullVerStr.indexOf('[')>0)  {
    verStr = fullVerStr.substring(0,fullVerStr.indexOf('['));
  } 
  else {
    verStr = fullVerStr.substring(fullVerStr.indexOf('MSIE')+4,fullVerStr.length);
    verStr = verStr.substring(0,verStr.indexOf(';'));
  };       
  // msie < 5.0 or navigator < 4.75
  if ( ( (msie >= 0) && (parseFloat(verStr) < 5.0) ) ||
       ( (msie < 0) && (parseFloat(verStr) < 4.75) ) ) { 
    payWin=open("settings.html", "displayWindow","width=700,height=400,status=no,toolbar=no,menubar=no,scrollbars=yes,resize=yes,top=100,left=35");
  } else {location.href='https://paylicence.transport.wa.gov.au/trelisWeb/trelis_jump_start/singlePayment.html'};            
}
Boiled down, it works out that non-IE browsers that have the digits 0, 1, 2, 3 or 4 as the fourth character in their navigator.appVersion string will be sent to the non-existent settings page, all others will be sent to the payment page.

IE goes to the payment because its navigator.appVersion string is "4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)" - it has "MSIE" in the string, which means the "6.0" version is correctly parsed out.

Firefox goes to the payment page because its navigator.appVersion string is "5.0 (Windows; en-US)" - the fourth character is a space, which becomes version NaN (not a number). Any comparsion with NaN is false, which lets Firefox through to the payment page.

Opera gets sent to the settings page because its navigator.appVersion string is "9.10 (Windows NT 5.1; U; en)" - the fourth character is "0", which becomes version zero - too old!

To get past this code in Opera is simple - change the site-specific preferences to get Opera to Identify as Firefox or Internet Explorer. However, you then bump into server-side browser sniffing on the payment site - Opera gets an XML file with error data. The solution is the same.

It's always disappointing when Opera is stymied by such inempt programming. Most users would just see another site that doesn't work in Opera - nudging them back to IE or Firefox (or whatever they used before Opera) - even though the fault lies with the site, not Opera.

Merry Christmas!PalmOS Bitching

Comments

scipio 14. January 2007, 12:00

Originally posted by Andrew Gregory:

function snif()


I wonder what a web designer thinks when he writes a function with that name. Does he think...
..."careful with this, it may cause problems"?
..."this is great, it will spare me the trouble of testing in more than one browser"?
..."I have no idea what this does, but other major sites have it as well so it must be good"?
...

:insane:

Andrew Gregory 21. January 2007, 03:43

Well the site maintainer has been quite responsive. They've added some extra text that sort of explains how to work around things in Opera. They intend implementing a proper fix, but the second server-side issue is apparently much more complicated (perhaps third-party code they can't directly change).

Still, it's a good sign :up:

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.

Download Opera, the fastest and most secure browser
January 2010
S M T W T F S
December 2009February 2010
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30