views:

80

answers:

2

Hi folks,

I often see sites using iframes containing an external site, and a top frame containing JavaScript functionality for the user.

e.g. user analytics software, Digg bar, etc...


Any tips for experimenting on something similar? =) Would be awesome to know

+5  A: 

No, not from outside the iframe. An <iframe> is its own world. If the domains etc. match, then Javascript can communicate in and out, and could (if it wanted to) inject CSS into a child frame.

If the <iframe> contains content from a different domain, there's pretty much nothing you can do. The parent page controls the size of the frame and whether it's visible, and can put its own content over the frame by positioning etc, but it can't directly effect the way the actual frame content is rendered.

Pointy
@Pointy: thanks so much! What if the domain is the exact same as the host page?
RadiantHex
If you're on the same domain, then Javascript from the parent page can mess with the contents of the frame. The parent page CSS won't affect the frame page, but Javascript can change the CSS or change element styles etc.
Pointy
+1  A: 

I think these are pretty much your only two choices: http://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe

Shean Hoxie