<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Ajax on IE 7: Check native first</title>
	<link>http://www.ajax-blog.com/ajax-on-ie-7-check-native-first.html</link>
	<description>Tutte le migliori news su Ajax e Web 2.0</description>
	<pubDate>Tue,  6 Jan 2009 12:11:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: IEBlog : An XMLHTTPRequest tip</title>
		<link>http://www.ajax-blog.com/ajax-on-ie-7-check-native-first.html#comment-2</link>
		<pubDate>Thu, 08 Jun 2006 22:36:16 +0000</pubDate>
		<guid>http://www.ajax-blog.com/ajax-on-ie-7-check-native-first.html#comment-2</guid>
					<description>[...] An XMLHTTPRequest tip Over on the Ajax Blog, Dion Almaer passed on an important tip from Brent Ashley and Tim Aiello for AJAX developers – to have your cross-browser AJAX work better with IE7, you really should be invoking the native XMLHTTPRequest (the cross-browser one) first to see if it’s available before instantiating the ActiveX control, instead of the other way around. In addition to the reasons that Brent and Tim discovered, I’ve seen a bunch of code that creates the&amp;#160;XMLHTTPRequest object, uses it for a request, and then throws it away. &amp;#160;Obviously, this is a lot less performant than keeping the object around for multiple requests. &amp;#160;The native object's lifetime can be as long as that of the page. So you can reuse it like this: &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var&amp;#160; o = new XMLHttpRequestObject()&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.open(“GET”, “data1.xml”,&amp;#160; TRUE);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.onreadystatechange = foo();&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.send();&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; …….&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.open(“GET”, “data2.xml”,&amp;#160; TRUE);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.onreadystatechange=bar();&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; o.send(); Xmlhttp.open has a “reset” semantic so the second open() call on the same object will abort the previous connection, disconnect previous event handler, and reset the object. There's also a handy tool by Julien Couvreur for debugging XHTMLHTTPRequest calls&amp;#160;for IE, or you can use Fiddler. -Chris  Published Thursday, June 08, 2006 3:30 PM by ieblog Filed Under: Tips and Tricks, Developers [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] An XMLHTTPRequest tip Over on the Ajax Blog, Dion Almaer passed on an important tip from Brent Ashley and Tim Aiello for AJAX developers – to have your cross-browser AJAX work better with IE7, you really should be invoking the native XMLHTTPRequest (the cross-browser one) first to see if it’s available before instantiating the ActiveX control, instead of the other way around. In addition to the reasons that Brent and Tim discovered, I’ve seen a bunch of code that creates the&nbsp;XMLHTTPRequest object, uses it for a request, and then throws it away. &nbsp;Obviously, this is a lot less performant than keeping the object around for multiple requests. &nbsp;The native object&#8217;s lifetime can be as long as that of the page. So you can reuse it like this: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var&nbsp; o = new XMLHttpRequestObject()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.open(“GET”, “data1.xml”,&nbsp; TRUE);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.onreadystatechange = foo();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.send();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; …….&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.open(“GET”, “data2.xml”,&nbsp; TRUE);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.onreadystatechange=bar();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.send(); Xmlhttp.open has a “reset” semantic so the second open() call on the same object will abort the previous connection, disconnect previous event handler, and reset the object. There&#8217;s also a handy tool by Julien Couvreur for debugging XHTMLHTTPRequest calls&nbsp;for IE, or you can use Fiddler. -Chris  Published Thursday, June 08, 2006 3:30 PM by ieblog Filed Under: Tips and Tricks, Developers [&#8230;]
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
