Dissecting the Freemind Viewer
I just wrote my first Google Module! It integrates into the Personalized Homepage the Freemind Browser, which is a Java applet that allows you to view Freemind mind maps in a web page. The module allows you to set height, width and location for the files.
The purpose of this module was to create an easy way of showcasing Freemind Mind Maps while staying as close as possible to W3C DOM methods and standards; the javascript places the mind maps using object elements instead of applet elements.
Issues
I found out that Konqueror and Internet Explorer don’t like javascript to create objects with a width of 100%. I had to get the width of an element with the .clientWidth method and then set the object’s width.
Opera and Internet explorer had the same weird bug: when I created the object and placed it using the appendChild() method, the java object appeared broken. I stumbled with a solution by placing the innerHTML of the div in a popup (while debugging)… it turned out that the code was fine, but something is wrong with the browsers that the applet doesn’t get started (or something like that). The solution I used was this: _gel(”id”).innerHTML = _gel(”id”).innerHTML. _gel is the Google Homepage API equivalent of document.getElementById(”id”). But, as you can see the solution was to run something like ‘a = a;’.
The problem with this was that in Internet Explorer, the objects were ’simplified’ after using the a=a method (I’d say ‘corrupted’). So after placing a new object and making ‘a=a’, the first object would appear broken… and the second object would now be normal. I tried other alternative methods like cloneNode, createDocumentFragment, pushing to a new array… etc. But nothing worked, except ‘a=a’. So, if only one mind map could be rendered, I had to disallow multiple mind maps in Internet Explorer… The good news is that I place this message when the user tries to add another mind map:
Internet Explorer is a really buggy browser. Why don’t you get a real browser, like Firefox
In other news, I also found out why I had been having errors in Internet Explorer when appending an object (using javascript) element to another object element (.html). That is because the object element in Internet Explorer doesn’t allow other elements to be appended unless they’re ‘param’ elements. So, trying to append a link, a textNode or a paragraph will result in an error in IE6.
Tests:
- On (K)Ubuntu Linux (works in all of them):
Firefox 1.5.0.4
Konqueror 3.5.2
Opera 8.51
- On Windows XP SP2 (works with limited functionality):
Internet Explorer 6
- On Mac OS X (Still haven’t tested in Safari)
Safari
If any passer-by that reads this is on a Mac please test the gadget in Safari, since I haven’t been able to test it in that browser. But I understand that, since it uses the KHTML engine, it should also pass the test, like in Konqueror.
I’ll write about the code when I officially publish the Google Gadget.
Post a Comment