This post originated from an RSS feed registered with Python Buzz
by Carlos de la Guardia.
Original Post: Plone and Dojo: 80004004 strikes again
Feed Title: I blog therefore I am
Feed URL: http://blog.delaguardia.com.mx/feed.atom
Feed Description: A space to put my thoughts into writing.
I really like the Dojo Toolkit and how you can spice up a web page using it, but every time I want to use it with Plone and MS Internet Explorer, there's pain and suffering involved.
I mantain a custom version of the ZPDojo product which includes the latest Dojo release (4.1 as of this writing). By the way, I would like to update the existing ZPDojo product with my version, but my attempts at contacting the mantainers of the original product have failed so far. Should I just fork?
Anyway, some months ago, I ran into a problem with version 3.0 where simply enabling dojo.js on the javascript registry caused IE to abort all Plone pages with a cryptic 80004004 error number. Depending on the browser configuration, nothing was displayed on the page or the user was redirected to the 'friendly' IE DNS error page.
That time I managed to find a couple of lines that seemingly caused the error and commented them out, because I didn't have time to find the real cause. But this week I ran into this problem again.
For a client, I created an ajaxy front-end for a time-consuming, server-side process, so that the status of this task is updated on the web browser while it is running on the server.
Dojo's progress bar and io services in combination with Zope and Python generators made this development an ejoyable experience, but when the time came to test my masterpiece in IE, there was old 80004004 preventing me from using the site, let alone test my new development.
The commenting out strategy I used with 3.0 didn't work, proving that the real cause was something else. I used the weekend to try to find out the root of the problem. I even booted Windows and downloaded the Script Debugger to follow along line by line and see where the script was crashing.
After hours of fruitless javascript debugging, I decided to attack the problem from the other side. Since Dojo works alright on IE when not using Plone, I started to pare down Plone's main_template, trying to find the bit that conflicted with Dojo.
Well, after a few minutes, I was down to 6 lines of HTML code total for the template, including only the script tag for dojo.js and an empty body, and it still refused to load.
At this point, the only difference between a simple Dojo HTML test and the Plone page was the base tag that Zope adds to every page even if it is not included in the HTML. I created an HTML page outside of Zope including this tag and there was old 80004004 again. That was it: Dojo doesn't like the base tag that Zope uses.
Once I knew this, it was easy to find information about the problem, including a simple solution, which unfortunately needs an alteration to the main_template. Just change the singleton base tag that zope creates to an empty tag for IE, like this: