This post originated from an RSS feed registered with Java Buzz
by Kevin Dangoor.
Original Post: When to use XMLHttpRequest and when to use IFrame
Feed Title: Blue Sky On Mars
Feed URL: http://www.blueskyonmars.com/feed/?cat=8%2C13%2C14
Feed Description: Kevin Dangoor's Weblog of Technology, Entertainment and Life - Java only feed. For all articles, check out http://www.blueskyonmars.com
Joel Webber dissects maps.google.com in Mapping Google. He spent a good deal of time getting into what all is being done by Google Maps. Here's an interesting takeaway:
I mentioned before that there was some advantage to be had by using a hidden IFrame over making direct XMLHttp requests. One of these is that the IFrame's state affects the back button. So every time you do a search, it creates a new history entry. This creates an excellent user experience, because pressing the back button always takes you back to the last major action you performed (and the forward button works just as well).
This leads to a good rule of thumb. If you're updating the page with new or updated information, you most likely don't want a history event. So, use XMLHttpRequest. On the other hand, if you're working in resposne to a user request, it would often be better to use the IFrame approach in order to preserve back button behavior.