Create an Account
username: password:
 
  MemeStreams Logo

Cross Domain Demo Parent Page

search

Acidus
Picture of Acidus
My Blog
My Profile
My Audience
My Sources
Send Me a Message

sponsored links

Acidus's topics
Arts
Business
Games
Health and Wellness
Home and Garden
Miscellaneous
Current Events
Recreation
Local Information
Science
Society
Sports
Technology

support us

Get MemeStreams Stuff!


 
Cross Domain Demo Parent Page
Topic: Miscellaneous 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

Cross Domain Demo Parent Page



 
 
Powered By Industrial Memetics
RSS2.0