Friday, 13 November 2009

Ajax Cross-domain

We have a web project that the 90% of the data it's taken from an outer domain. As the client forced us to make the queries directly to the other domain, we decided to use flXHR.

flXHR is a *client-based* cross-browser, XHR-compatible tool for cross-domain Ajax (Flash) communication.”

As we used jquery for build the tables, the right solution seems to use the flXHR jQuery plugin. And all seems right while we were testing in firefox and IE 8, but when we began to test it in IE7 we saw that "sometimes" after the refresh of the page... we had the CPU up to 100% and the IE7 blocked.

After a refactorization and finally a total simplification of the page, we saw that the only way to use safely flXHR was putting the include of the flXHR.js file at the end of the page, or at least the last one of all the js includes of the page.

The next simple example ends with 100% CPU if you refresh the page quickly so many times (source):