Hacker News new | ask | show | jobs
by nephesh 5357 days ago
Not to disagree, but this type of scenario has become much easier to deal with using iframe's and postMessage (https://developer.mozilla.org/en/DOM/window.postMessage). You can basically setup a client script that is embedded as the widget and some javascript inside your iframe to talk between each other. Just thought I'd throw out another option for those that are looking for one.
1 comments

There is that, which is nice when you can get away with it. Unfortunately I still consider this the "hard" approach for a few reasons.

1. Supporting IE7, for which people tend to use an intermediate Flash object to do the communication.

2. There's still the content size problem. Does your IFRAME'd widget change size? Now you need to detect all size changes with JavaScript and send them back to the host page so it can resize the IFRAME.

3. Is your widget non-rectangular or concave? For instance, can it pop out a menu of a different size than the widget itself? Well, now you need an additional IFRAME for each piece that sticks out.