SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Location
    India
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML5 cross document messaging vs. crossdomain policy.

    Hello all,

    This may be a totally foolish question. if so, apologies in advance!

    I am reading about HTML5 and I read about this new Cross Document Messaging API. Whatever I've understood is it will help communicate between documents being served by most probably different subdomains, which people mostly use to enhance performance and maintain/organize structure of files on the server.

    I've been using crossdomain.xml and allowing access to resources from http://www.domain.ext, http://domain.ext and http://*.domain.ext with just 3 lines of code in crossdomain.xml. What extra advantage am I going to get out of 'postMessage API' as I've been unable to find any real world examples where this postMessage API is being used?

    Any light thrown on the matter will be highly appreciated.

    Thanks in advance,
    Anagha.b
    Last edited by TechnoBear; Oct 3, 2012 at 03:45. Reason: Example URLs delinkified

  2. #2
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    crossdomain.xml only does anything for Flash. The browser doesn't care about that file at all.

    If you want to communicate with a document in an iframe or a popup window and it is not in the same origin, you can use postMessage.

    If you want to read a resource from a different origin, you can use XHR, assuming that origin allows you to read it with CORS.
    Simon Pieters

  3. #3
    SitePoint Member
    Join Date
    Oct 2012
    Location
    India
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zcorpan View Post
    crossdomain.xml only does anything for Flash. The browser doesn't care about that file at all.

    If you want to communicate with a document in an iframe or a popup window and it is not in the same origin, you can use postMessage.

    If you want to read a resource from a different origin, you can use XHR, assuming that origin allows you to read it with CORS.
    Thanks so much! Clears things for me. If you can recommend any resource for more info on the matter, I'll be ever so thankful to you.

    Best,
    Anagha

  4. #4
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check out the spec for postMessage at http://developers.whatwg.org/comms.html (this version of the spec is aimed at Web developers).
    Simon Pieters

  5. #5
    SitePoint Member
    Join Date
    Oct 2012
    Location
    India
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zcorpan View Post
    Check out the spec for postMessage at http://developers.whatwg.org/comms.html (this version of the spec is aimed at Web developers).
    Many thanks again! . Will go through it asap.

    Cheers!
    Anagha


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •