ZF-6891: ReCaptcha rendering could cause sporadic page errors in IE6-7 based browsers
I've heard from time to time from visitors of my site a complaint, they can't use registration form (with ReCaptcha) of the site with their IE6-7 (and also with some IE-based browsers, like Avant Browser) because page emits "Internet Explorer Cannot Open the Internet Site- Operation Aborted" error or just renders invalid. I failed to reproduce this error myself for long time and had no idea about the cause of the error. This error cost me about 50-70% of IE-users wanted to register in my site. That is a high cost, isn't it? Yesterday I was able to reproduce it and find the solution, and I want to share it.
script tag directly in a place of page where ReCaptcha widget should be located. When browser loads a page, it fetches script over a net and executes it. During that execution, the script does a lot of document.write() (and possibly modifies .innerHTML or do appendChild() and so on) that causes unclosed DOM container modifications. This behavior could cause sporadic errors in IE because of the process of page DOM loading could be incomplete to the time of DOM modification.
Please, take a look into Microsoft Knowledge Base article http://support.microsoft.com/default.aspx/kb/… for more information about the error.
This error is VERY hard to reproduce (you may Google for it and find a discussions like http://nirmaltv.com/2007/08/… ), because there are a lot of things to affect. Some of visitors never encounter that bug, some - encounters it always, some - from time to time. I think, the following things (timimg things) could effect: - network connection speed - if the recaptcha script is browser or proxy (!) cached - overall computer performance - ?
I was able to reproduce the error with my registration form in IE6 only when I cleaned browser cache and navigated to a local development version of site. Doing the same with public production site didn't reproduce the error.
One possible solution is to use AJAX API to load and instantiate ReCaptcha widget after DOMContentLoaded (or body onload) event signalled. I'm going to code this method, but it would be a very quick&dirty method due to a lack of free time and I don't think it worth committing in ZF project. But if someone wants it as starting point - I'll share it, just let me know...
//going to send a link to this page to ReCaptcha team