思归呓语

衣带渐宽终不悔,为伊消得人憔悴
随笔 - 409, 评论 - 2969, 引用 - 245

导航

关于

标签

每月存档

最新留言

广告

 

IE8带来了一堆改进和新功能,这些改进包括CSS 2.1 兼容,开发者工具,更好的AJAX开发支持等,详见
How do I make my site 'light up' with Internet Explorer 8?
http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/DevelopersNew.htm

比较关心的是涉及AJAX开发的,更为详细的文档在这里
Better AJAX Development
http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=ie8whitepapers&ReleaseId=581

这些改进包括:
1.AJAX导航支持(前进,倒退按钮工作了!)
2.DOM储存(简洁的API,每个域可在本地保存10M的数据)
3.网络连接事件(online以及offline事件,还可以通过window.navigator.onLine来监测连接状态)
4.把per host的并发连接数从2增加到6
5.XMLHTTPRequest改进,包括添置了timeout属性,以及ontimeout事件,以允许开发人员中止请求

更为激动人心的是对跨域请求(XDomainRequest-XDR)的支持!不再需要通过同源服务器来作为代理服务器,只要异域返回 XDomainRequestAllowed=1的header就可以(譬如通过Response.AppendHeader("XDomainRequestAllowed","1") ):

// 1. Create XDR object
xdr = new XDomainRequest();

// 2. Open connection with server using POST method.
xdr.open("POST", "http://www.contoso.com/xdr.txt")

// 3. Send string data to server.
xdr.send("data to be processed")

以前曾在博客里谈到如何通过URL的hash来在来自不同域的网页之间通讯,绝对是比较丑陋的方案:
http://blog.joycode.com/saucer/archive/2006/10/03/84572.aspx

IE8现在支持跨文件消息通讯(Cross-Document Messaging-XDM)!通过onmessage事件和postMessage方法,两个来自不同域的网页可以进行通讯:

窗口A:(来自contoso.com)

// 1. Create event handler for message event.
<document.onmessage = HandleMsg()>

// 2. Post message to a secure page B.
window.postMessage("Hello world", "https://lucernepublishing.com")

窗口B:(来自lucernepublishing.com)

// 3. Create event handler for message event.
<document.onmessage = HandleMsg()>

// 4. Create event object off window.

var e = window.event

// 5. Check domain on received event to ensure the message
// comes from the expected domain.

if (e.domain = "contoso.com")
if (e.scheme = "HTTPS")

// 6. Retrieve data from event.
var data = e.data

// 7. Send return message to Page A.
e.source.postMessage("Hello")

打印 | 张贴于 2008-03-07 00:09:52 | Tag:ASP.NET/IIS  AJAX/ATLAS

留言反馈

#re: IE8 Beta 1的AJAX支持以及跨域新功能 编辑
IE8? 放出来了?
2008-03-10 15:11:23 | [匿名用户:intermapper]
#re: IE8 Beta 1的AJAX支持以及跨域新功能 编辑
如果只是Microsoft支持的标准而不是行业标准,则只能适用于企业级开发了
2008-03-07 09:35:22 | [匿名用户:Ariel Yang]
#re: IE8 Beta 1的AJAX支持以及跨域新功能 编辑
看样子很酷
2008-03-07 09:04:03 | [匿名用户:huobazi]
博客主人设置本博客不允许匿名用户发表言论,请登录后再试

Powered by: Joycode.MVC引擎 0.5.1.0