nextwebgen.com

The Next Generation Web Now

IE7 XMLHttpRequest - Native or Not?

Filed under: Web 2.0 News, Front Page, XmlHttpRequest, IE — Michael Mahemoff at 2:42 pm on Friday, July 28, 2006

MS announced this week that IE7 will be pushed as a high-priority update, so we can expect it to be popular pretty quickly. Reader Shawn Lauriat brought our attention to the question: How native is IE7’s XMLHttpRequest?

The IE team have promoted the new IE7 as including native XMLHttpRequest. This is the case, insofar as you can instantiate an XHR using new XMLHttpRequest(). More importantly than the syntax, XHR will still work when ActiveX has been disabled (unlike IE6 and below).

On the other hand, Shawn notes that some issues exist. Some have pointed out that its more of a native facade than a native Javascript object. Specifically:

  • xhr.prototype fails. Indeed, it’s reported that any dynamic member creation fails (e.g. xhr.callId = 25; an idiom that can be useful for Call Tracking). If this is still the case, it’s not the behavior of a native object and it’s not consistent with other browsers.
  • It’s also worth pointing out that IE has an option to disable native XHR. (Aside: can we switch to positive terminology already - “enable” rather than “disable” … it’s hardly a secret of HCI that options should be stated in the positive :-/). The XHR option is, reasonably enough, motivated by security. Although it sounds like XHR will default to enabled (sorry, “not disabled”), it’s still a reality that some users will be continue to be lost if you rely on XHR. Don’t throw out that IFrame just yet!

IE7 XHR - Native or Not?

XMLHttpRequest Quirks and PHP

Filed under: Web 2.0 News, Front Page, PHP, XmlHttpRequest — Chris Cornutt at 9:34 am on Monday, July 24, 2006

On his blog, Jacob Santos has written up two simple “gotchas” that he’s come across in his PHP/XMLHttpRequest adventures and wanted to share with other developers forging their way through the same experience.

I didn’t find the AJAX frameworks much use while I was working on my current project. I’m sure they are well thought out and designed, but after going through two or three, I was more lost than when I started. I decided then that I should learn how this whole AJAX thing works from the ground up. Turns out XMLHttpRequest isn’t all that difficult, once you get past a few JavaScript cross browser hiccups.

He talks briefly about his PHP backend and the methods that are available to return data in (XML/HTML/JSON) before talking about the issues he found:

  • Don’t Create an Instance of the Same Object For multiple Tasks
  • Always Call XMLHttpRequest Object First

For both, he gives a bit of code to explain the issue and to illustrate a workaround method, including the full code at the end of the post.

XMLHttpRequest Case-Sensitive in IE7

Filed under: Web 2.0 News, Front Page, XmlHttpRequest, IE — Chris Cornutt at 7:59 am on Thursday, July 20, 2006

Sleepyhead has posted a quick note about the XMLHttpRequest support in Internet Explorer 7, some bad news - it’s case-sensitive.

The native XMLHttpRequest object in IE7 is case-sensitive. This is no big surprise - however that was not the case with the XMLHttpRequest active-x object in earlier versions of IE. So if you have old code that used uppercase in method/functions that worked with IE6 you have to change it for it to work in IE7. Took me a while to figure out why an old script of mine wasn’t working…

He gives the code example for his fix, noting that “Status” will no longer be the same as “status”.

Go forth and API

Filed under: Web 2.0 News, Front Page, Programming, XmlHttpRequest — Chris Cornutt at 9:28 am on Tuesday, July 11, 2006

Backend scripts aren’t the only way to access the wealth of valuable web services out there. Anyone that’s done any playing around with Ajax can see the possibilities of combining the two - accessing the APIs directly from your client-side application. In this brief tutorial from ThinkVitamin.com, they follow this course and give you a simple example to get the ball rolling.

To most, the virtues of Web 2.0 are rather ephemeral; that’s always been one of its main criticisms. However, I like to think that one of the movement’s key aspects is a sense of community, an ability to create sites and applications that bring people together.

Even Web APIs aren’t a new idea. Google’s search API has been available via SOAP since 2002, and there’s definitely older services than that. However, the recent growth in Web API availability has been fuelled by two recent developments. The first, which I’ve already mentioned, was a philosophical change in the way that data is handled. The second was the introduction of AJAX. Again, not a new idea, or even a new technology, but sometimes it’s all about timing.

They mention several of the different APIs out there (including Flickr, Google Maps, and Amazon) as well as some of the mashups that take advantage of the merging of these APIs. To illustrate the point of the simplicity of these interfaces, they include a code example of connecting to the Flickr API to grab photo information. There’s also a bit on proxying your XMLHttpRequests and a brief look at using JSON to communitcate with the APIs that support it.