Create an Account
username: password:
 
  MemeStreams Logo

MemeStreams Discussion

search


This page contains all of the posts and discussion on MemeStreams referencing the following web page: Cross Domain Demo Parent Page. You can find discussions on MemeStreams as you surf the web, even if you aren't a MemeStreams member, using the Threads Bookmarklet.

Cross Domain Demo Parent Page
by Acidus at 9:10 am EDT, Aug 24, 2009

On way of doing cross domain communication is to have a parent page in 1 domain and an embedded iframe pointing to another domain. The 2 domains can both access the fragment of the URL that specifies the location of the iframe. Thus you can use iframe fragment identifiers for cross domain communication. Typically this is done by both sides polling the URL of the iframe using setTimeout() and looking for messages. This adds a lot of latency and introduces race conditions where messages can get clobbered.

[aside]
I looked into using this for Jikto to communicate with its UI. However Jikto only required a very primitive "UI to scanner" interface (namely, "start"" and "stop") while it had a widely used "scanner to UI" interface to bubble out URLs that had been scanned, vulnerabilities that it had found, debugging information, and status/progress messages. Instead I used JavaScript's native Image object to make throwaway, blind GETs to send the data to a web backend that the UI pulled from. If the improved method below had been available I would have used it and bypassed the server-side data store requirement completely.
[/aside]

The linked demo page shows a very cool improvement to the iframe fragment communications channel method. Instead of polling it uses onresize to interrupt the opposite side and ensure the message is acted on immediately.

More here at Ajaxian


 
 
Powered By Industrial Memetics