easyxdm
DESCRIPTION
TRANSCRIPT
easyXDMMaybe it is the best and easist cross-domain scripting
in the world
Wilson2010-12-19
1
Scenarios
2
Same Origin Policy
• var getReply = function (id) {• $.get(“http://disqus.com”, {• 'post_id': id• }, function (data) {• //….• }, 'json');• }
3
Same Origin Policy
• var getReply = function (id) {• $.get(“http://disqus.com”, {• 'post_id': id• }, function (data) {• //….• }, 'json');• }
4
Same Origin Policy
Prevent the loss of data confidentiality or integrity
5
Yea,but what if …
I own both sites and I just want to make them talk?The site I want information from says it’s okay?I don’t give a shit?!
6
The solution
Window.postMessage
Works in…•FF3+•IE8+•Chrome 1+•Safari 4+•Opera
7
The solution
JSONP
8
The solution
Server-Side Proxy
9
The solution
• HTML5 Cross-Document Messaging• W3C XMLHttpRequest Level 2• IE8 XDomainRequest• iFrame hacks• …
10
都是浮云!
11
Men,we need a bit of flexibility
12
easyXDM
• use postMessage first and then a series of use postMessage first and then a series of different techniques based on which browser different techniques based on which browser
you use, but with normalized syntaxyou use, but with normalized syntax
14
easyXDM
15
Setting up your first Socket
• The provider
16
Setting up your first Socket
• The consumer
17
Cross-domain AJAX
• The provider
18
Cross-domain AJAX
• The consumer
19
So easy,right?
20
21
Thanks!
• Wilson Lin• @willing8310• [email protected]• http://36kr.com
Please feel free to contact me if any questions.
22