Tuesday, July 1, 2008


So I make the whole App... everything is working well and good and then suddenly when I decide to check it on Internet Explorer 7, nothing's coming.

Oh no... where did I go wrong??

Luckily, Mozilla Firefox allows for a handy debug tool for JavaScript Programmers called FireBug. Internet Explorer on the other hand sucks cos its so developer unfriendly. After a lot of trouble I found something called DebugBar which was supposed to help me debug... but all it did was showed me errors in a more flamboyant way with no information whatsoever about its cause.
“Object doesn't support this property or method”


By doing a lot of try-catch, I finally zeroed down to the cause of the error.
(What I had been doing was, I had used a XSPF(XML Shareable Playlist Format) JSPF parser written by Chris Anderson (which he had put under GPL V3) which actually converted a XML to JSON which i then used in my App.) The line that caused the error was the very same line in which I did the parsing thing. Now what was i going to do?

Prateek came to the rescue. He suggested using XPath to get data from the XSPF Playlist("After all its nothing bu XML"). Only that I did not know how it was used.

Google refered me to w3schools.com.

Just when I started to get the hang of XPath, I decided to check out its examples. w3schools has those innovative Tryit Editor which lets you edit the examples and see the results alongside. Well I had not even touched the examples. They just wouldnt show results that w3schools claimed it would do.

I decided to copy-paste the examples and try it myself... no result. I tried it on IE7 ... there it was XPath at work... But not working in Firefox 3... generally its always the other way round. What was happening... things working on Internet Explorer 7 not Firefox...


Even Firebug turned me down. Just the good ol' Error Console with a huge error the gist of which was :
"Node cannot be used in a document other than the one in which it was created"

A thread in a googlegroup said that that was due to a security fix in Firefox 3 and then gave some links that apperently had the solution to my problem... but sadly I could not make any head or tail out of it.

Prateek insisted that we realease Muziboo App v1.0 with a Flash Widget doing all the parsing and playing... but I was adament... cummon... all this hard work just to see a worthless Flash Widget take away all the glory. I'd rather parse the playlist myself... but that was kinda tough.

And then he told I should write a Parser myself! What am I ? JavaScript Coder Of the Year or Something??(I could parse the playlist to get what I wanted, but to make a parser that would parse any playlist, work on any browser was asking a lot out of me)

And in all the quarreling I had an idea. I had already written enough XPath to parse the playlist for IE7 only the error was on Firefox 3 (only?? Its already so popular, its on the verge of a World Record).

So what I could do was I could check which browser was running, If I was Internet Explorer I parsed it myself otherwise I did it the Chris Anderson way...

P.S. We are going to apply for submission of the App tomorrow night. Only some CSS alignment issues to me taken care of which should be done with by then.


jfrabaute said...


For javascript errors you can try Companion.JS (http://www.my-debugbar.com/wiki/CompanionJS/HomePage) which is a free complement to DebugBar and gives detailled info about javascript errors.

DebugBar is mainly for DOM/CSS and HTTP info, with some basic javascript features.

Hope this helps.


Kai Jim said...

I am not sure that this is the same problem. However, there is a bug with Firefox 3 and Firebug.
The bug creates some problems when parsing XML. More infor can be found here: http://acidmartin.wordpress.com/2008/06/25/strange-bug-with-firefox-3-and-firebug-120b3/

Hope this helps.

$hRiNk said...

Will try these in future !