Mxhr

690 views

Published on

mxhr introduce

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
690
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Mxhr

  1. 1. MXHR技术探究 (Multipart Xml Http Request) http://github.com/xiaojue http://twitter.com/xiao_jue
  2. 2. Multipart Content-Type MIME (Multipurpose Internet Mail Extensions) IETF (Internet Engineering Task Force) RFC (Request for Comments) text/html html text/css css image/x-icon ico image/jpeg jpegContent-type: multipart/mixed; boundary="simple boundary"
  3. 3. multipart-body := preamble 1*encapsulation close-delimiter epilogueencapsulation := delimiter CRLF body-partdelimiter := CRLF "--" boundary ; taken from Content-Type field. ; when content-type is multipart ; There must be no space ; between "--" and boundary.close-delimiter := delimiter "--" ; Again, no space before "--"preamble := *text ; to be ignored upon receipt.epilogue := *text ; to be ignored upon receipt.body-part = <"message" as defined in RFC 822, with all header fields optional, and with the specified delimiter not occurring anywhere in the message body, either on a line by itself or as a substring anywhere. Note that the Backus-Naur Form (BNF) 是一种描述语 semantics of a part differ from the semantics 法的方法,比如 ACL 语法。它通常用 of a message, as described in the text.> 于开发 Internet 协议,因为 BNF 十分 简洁而且非常准确。http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
  4. 4. usage scenario MTA(Mail Transport Agent) From: Nathaniel Borenstein <nsb@bellcore.com> To: Ned Freed <ned@innosoft.com> Subject: Sample message MIME-Version: 1.0 Content-type: multipart/mixed; boundary="simple boundary" This is the preamble. It is to be ignored, though it is a handy place for mail composers to include an explanatory note to non-MIME compliant readers. --simple boundary This is implicitly typed plain ASCII text. It does NOT end with a linebreak. --simple boundary Content-type: text/plain; charset=us-ascii This is explicitly typed plain ASCII text. It DOES end with a linebreak. --simple boundary-- This is the epilogue. It is also to be ignored.
  5. 5. As3 Loader … Socket io…Server client http... Ajax… Jsonp… Mxhr
  6. 6. combineNginx concat combo,PHP MinifyLocal PackageCssjs mergemxhr
  7. 7. http://site.douban.com/widget/notes/6513752/note/197185582/XMLHttpRequestPerfect?
  8. 8. Digg Request: var template; $.mxhr({ url: /fictonal/bsg/endpoint.mxhr, type: GET, text/html: function(data) { template = data; }, application/json: function(data) { view = $.parseJSON(data); console.log(Mustache.to_html(template, view)); } }); Response: --||| Content-Type: text/html Hello {{world}}. --||| Content-Type: application/json {"world": "New Caprica"} --|||--https://github.com/dfltr/jQuery-MXHR
  9. 9. • MSXML2.XMLHTTP.6.0, MSXML3.XMLHTTP, Microsoft.XMLHTTP, // Doesnt support readyState == 3 header requests. MSXML2.XMLHTTP.3.0, // Doesnt support readyState == 3 header requests.• Ie6,7,8 dDoesn’t support data:url
  10. 10. IE6,7,8 support flashplayerDATA:URL in ie6,(7,8)?pass back ?As decode?Clinet PNG Analyzer?
  11. 11. MXHR IN ACTION
  12. 12. https://github.com/xiaojue/mxhrmanager
  13. 13. Q&A

×