Navigation Menu
loading content ...
Error Message
Macro 'toolbar' not defined, or not allowed to call [restricted_mode=False]
Rated 3.00/5.00 | Created 04 August 2009
Osmosoft recently launched a new website for ILGA (the international gay lesbian association). The main focus of the website is a map (built using my Vismo library) of the world showing legal information about topics such as "Are male to male relationships legal?" and in those countries where they are not legal exposes those countries that still think it is valid to punish two gay people with death.

As with all websites it's had a few teething problems, but the most recent one I came across was quite serious and felt was worthy of a blog post.

We got an email from someone who was at the website launch in Copenhagen at the outgames conference - they were trying to share the website in their company however when they tried it on their corporate network in IE6 the website wouldn't load. It transpired that they were getting a weird error message: "automation server can't create object". Of course at first glance due to the complexity of the VismoLibrary I felt I had overlooked something quite serious. However digging around revealed that in fact the error was caused because this corporate network had decided to disable ActiveX in the internet explorer 6 security settings for all their employees pcs (if making them use IE6 was not enough). The result of this was my seemingly harmless jQuery.ajax calls were failing as they were not possible.

So with the problem identified, time for solving. I wanted the most simple solution with minimal change to the server. Ideally I wanted to just change my javascript and not touch the head tags of pages on the ilga server. I got a solution which does just this.

Effectively what I do is test for browsers without the ability to create XMLHttpRequests. For these browsers I append a hidden IFRAME to the body in javascript, the source attribute of which is the url I am making an ajax call to. Then, when the iframe has finished loading it runs the success function as normal. The result = normal looking website for these niche users. Hurray.

The ILGA website has since been updated with this fix.
Here is the code for those interested:
        try { //see if I can do an ajax call
            var test = new XMLHttpRequest(); 
                ilga.ajax = jQuery.ajax; //default to using ajax for all happy browsers
        }
        catch (ex) {
            ilga.ajax  = function(options){ //define a new function which does exactly the same but with iframes
                if(options.url.indexOf("http://") == -1){
                    var x = document.createElement("iframe");
                    x.src = options.url;
                    x.style.setAttribute("cssText","display:none;");
                    document.body.appendChild(x);
                    jQuery(x).load(function(){
               
                         var response = jQuery(
                         x.contentWindow.document.body).text();
                        options.success(response);
                    });
                }
                
            };
        };
        

Thanks for reading this far. Did I bore you or interest you? Let me get better at doing the latter and focus more on working on the good stuff...
Error Message
Macro 'ratemytiddler' not defined, or not allowed to call [restricted_mode=False]
Comments
Error Message
Macro 'tiddlyWebComments' not defined, or not allowed to call [restricted_mode=False]
a list of older blog posts can be found at here

Please ignore the following if you are using a text browser (this is part of the TiddlyWiki application used to run this software):