Tuesday, February 28th, 2006p> On Sys-Con.com, there’s a short little look at two methods of doing a lot of the same things – a comparison of Ajax versus iFrames.
Should you use the old iFrame tricks or the new XMLHttpRequest? There is not better or worse when comparing these two techniques, but they are certainly different. While both of them allow you to communicate with the server in the background, you should choose the appropriate for your situation depending on a few questions: Do you want the back-forward buttons to work? Do you plan to perform more than one simultaneous request? Do you need cross-site calls? Do you need to monitor the status of your calls?
He answers these questions, most of them right away with a table listing of the differences between the two (“multithreaded”, “cross-site”, etc). These are followed by arguments for both sides, spotlighting things like:
- that iframes are easier to monitor, but won’t let you multi-thread
- Ajax tends to break the back button, but it’s also easier to understand what’s happening with it (via the status codes).
- neither supports anything that would allow cross-site scripting (for Ajax, a restriction. for iframes, the lack of control between parent/child)