IE 6 refuses to load page if dojo is loaded in HEAD and a BASE tag exists before
I recently had to fight with some odd issue with xPages and Internet Explorer 6. Yes right IE6 !! In my brand new intranet application I use the BASE tag in HEAD ( xpages property “pageBaseURL” ) to specifies a default address or a default target for all links on a page.
This worked properly in all browsers like IE7, IE8, Firefox 3.x, Safari etc. A few days ago a user called me and told me that he was not able to open the application in his Browser. I asked for the version and he replied IE6 !!
In this particular case, IE popups an alert saying: ” Internet Explorer cannot open the Internet site http://intranet.nsf. Operation aborted “.
I then began to investigate and after a lot of try and error I finally found the cause and after a few hours of further investigation and inspired by a blog post from Paul Withers I was able to implement a solution.
The problem is described in an old entry in the dojo toolkit bug tracking system .
There are also 2 solutions provided to work around this issue
- Put the BASE tag after the SCRIPT that includes dojo, or
- Revert hostenv_browser.js to rev.3024 which uses document.write for VML addition
I decided to choose the first option. But how to get the base tag into the HEAD after the dojo stuff? Paul posted some code to put js code into the HEAD. I tweaked it a bit and here is the result
<!-- IE6 Issue workaround START --> <xp:headTag tagName="base"> <xp:this.attributes> <xp:parameter name="href"> <xp:this.value> <![CDATA[#{javascript:return applicationScope.AppBaseURL;}]]> </xp:this.value> </xp:parameter> </xp:this.attributes> </xp:headTag> <!-- IE6 Issue workaround END --> </xp:this.resources>
Now the BASE tag occurs after the dojo stuff and the page opens in all browsers from IE6 on. The BaseURL is stored in a config document and put into the applicationScope.AppBaseURL variable on application init.