Monday, December 5th, 2005

Cross-document messaging: An answer to the cross domain debate?

Category: Editorial

Arve Bersvendsen, of Opera, has written about Cross document messaging, including examples to test it out in the Opera browser.

What is Cross-document messaging

Cross-document messaging is a little talked off HTML5/Web Applications 1.0 feature that the WhatWG has been specifying

How does it work?

You have senders and receivers:


function sendMessage(val){
  var receiver = document.getElementsByTagName("iframe")[0].contentDocument;


  var output = document.getElementsByTagName("textarea")[0];
  output.value += "Message from domain "
    +ev.domain+" and URI "+ev.uri+":\n";
  output.value +="\n\n";
  parent = ev.source;
  var d = new Date();
  ev.source.postMessage("The document at "
    +location.href+" received your message at "+d);
}, false);

Posted by Dion Almaer at 9:18 am
1 Comment

2.7 rating from 6 votes

1 Comment »

Comments feed

xdghdyjcyjdgynv g h fghfghfg dyh tduygh

Comment by ertet — October 31, 2007

Leave a comment

You must be logged in to post a comment.