AJAX XMLHttpRequest x IFrame
A new version of PHPClasses 2.0 Beta is being under tests, introducing new features and services for premium subscribers, you can check already the new AJAX Login page of the service. Manuel posted an interested comparaison between AJAX XMLHttpRequest x IFrame, explaining the reasons why he choosed IFrame versus XMLHttpRequest.
What I would like to share with you are the reasons why I have chosen IFrame over XMLHttpRequest objects.Since Mozilla 1.0 release, there is a lot of excitement in the Web development community regarding the use of XMLHttpRequest objects to implement AJAX enhanced applications.
However, after some preliminary studies, I have reached the conclusion that using IFrame is much better than using XMLHttpRequest objects.
These reasons are :
1- Browser compatibility : IFrame is widely suuported by new and old browsers while not all browsers in use support XMLHttpRequest
2- Browser security constraints : Under Internet Explorer 6, XMLHttpRequest requires an ActiveX component. The latest Microsoft security patches disable ActiveX by default. XMLHttpRequest is not available under the default security level of installations that use that security patch.
3- Single JavaScript base code : Several browsers now support XMLHttpRequest but each one has a different way to create these objects and access them. This causes a maintenance headache because you need to generate browser specific JavaScript code. IFrame is an HTML tag consistently supported across all modern browsers. A single JavaScript base code works with all supported browsers.
4- Response speed : tests have proven that XMLHttpRequest can be faster for small requests but IFrame can be faster for larger requests.
5- File form upload : With IFrame there is no need to access the actual form file input values. You just use the IFrame name to set the target of the form with the file input that you want to upload. When the form is submitted the file is uploaded with all other fields of the form. While due to security reasons you cannot access the value of form file inputs to populate an XMLHttpRequest.











AJAX Magazine's RSS
