Archive for the ‘technology’ Category

Firefox and Opera statistics are underrated

Wednesday, September 5th, 2007

While testing browser behavior regarding inline JavaScript evaluation and the back and forward buttons I found a very interesting thing. When a script is included in the HTML to execute on parsing (not on load but inline) Internet Explorer (7 on Vista tested) and Safari 3 for Windows will re-execute the script when a user returns via the back button. In my mind this is the correct behavior, since you actually visited the page twice.

The thing is that Firefox (2.0.0.6 on Vista tested) and Opera (9.20 on Vista tested) don’t agree with me. Well maybe they do and don’t live by their beliefs. What they do is nothing. You come back and no scripts are executed. Not even one request is sent to the server in Firefox.

This “feature” is sometimes a great thing – all the AJAXy stuff and all the JavaScript enhancements are already there and don’t need to be rendered again in turn saving power and time. At other times it’s a pain in the a** since some stuff does return to its default state and some doesn’t. This problem is most often observed with dynamic/advance forms that lose their default values/states. Since even onload is not fired this can get annoying…

Besides all the interface problems you might encounter due to this “rogue” behavior, there are also a few issues regarding statistics. It’s harder to inspect the path of a user, the time a user spent on a page, the number of page views in a visit and other related metrics. The other significant issue is that browser usage statistics might be skewed. To answer this last issue we’d have to know how these statistics are measured.

Let’s take a user that is used to clicking the back button while navigating a site with a 2 level deep navigational tree. She comes to the page, goes in one branch and then to a second, very distant branch. Internet Explorer would register 7 page views (1 on the root, 2 to get down, 2 back up and 2 more down), while Firefox would only register 5 page views (1 on the root, 2 to get down, ignore the 2 back buttons, 2 more down) – a 1.4:1 ratio.

If the statistics are based on sessions or unique users we have 50% IE and 50% FF. If we base them on hits we have 58% IE and 42% FF – a 16 percentage point difference or as we said before a 40% difference. This is not something you could just ignore…

Exercise for the reader – why do “unsupported” browsers always have a small browser share in hit based browser metrics?

Noscript with script?

Saturday, September 1st, 2007

When I was debugging a script last week I found a hilarious statement in it:

document.write('<noscript><a href="..."><img src="..." «
alt="..." /></a></noscript>');

Operation aborted

Saturday, September 1st, 2007

So I’ve been hacking some banners recently and encountered a weird error in Internet explorer (first in IE6, after testing the case also in IE7). While executing some Javascript code everything is executed normally but the thing pops an alert with ‘Operation aborted‘ message.

The case consists of a html page that includes a script from some other server that in turn loads another script from the same server. The reason to have so many scripts is that you can’t touch the html so what you have there has to be static, the second script includes configuration and the third script (that can easily be cached by browsers) includes all the code.

While trying to create and append a new element to the body element the thing broke with the afore mentioned message. After testing in other browsers I figured it’s probably not a domain issue (my first thought that made me think that the problem might be unsolvable). After that it was as easy as isolating the error – the code creates an element, adds some properties, adds content via innerHTML and then attaches it to the body element. Attaching was the culprit.

I don’t actually know what made me defer the function with setTimeout but that solved the problem. What I did was instead of calling the function immediately I used a setTimeout(fname,1); to move the function execution from the current “thread” to a new “thread”. I’m guessing that something isn’t ready yet after all the loading of scripts so IE gets annoyed.

I hope it helps. If it doesn’t you might want to check Operation aborted by Shaun Inman.

Calendar APIs

Monday, August 27th, 2007

I’m looking for a calendar web-app with full API access. I really don’t want to reinvent the wheel…

Get your jobs from UnorderedList

Saturday, July 28th, 2007

There are no more reasons to put up your own job board or even have your own local data about it.

List all the openings on UnorderedList and go to this Yahoo Pipe to get back whatever you want to get back. You can filter by company or location.

If this is not enough for you you can always go and duplicate the existing pipe and create your own…

script language attribute / JavaScript version

Tuesday, July 24th, 2007

There used to be a very nice attribute to the script tag that defined what version of JavaScript is present between the script tags. You’d say language=”JavaScript1.3″ and older browsers that only supported JavaScript 1.2 wouldn’t run the code. Unfortunately this is not the case anymore – the attribute has been deprecated and browsers don’t really support it anymore. IE says that JS 1.3 is the latest version it supports, Firefox and Safari support 1.7. Opera supports 1.5 and surprisingly all the 2.x version (huh?) and the browser in Blackberry (the reason for testing this) supports everything.

I know – search for what you need, but in this case I don’t really want to check for all the objects and methods that I need…

Check your own browsers JavaScript support.