sscotti
asked on
Add style to cross domain iFrame
I want to add a style to a cross domain iframe so that the left nav and header are hidden in the iframe. I basically just want to display the main content in the iframe.
I know that doing this with javascript is problematic due to security restrictions. I don't have easy access to the iframe code but I might be able to add something as it is on the Point2 realestate site and there might be a way to add content but I think I would have to add some javascript.
If so, maybe there would be a way to just check if there is a parent frame and if the parent frame is my frame. I could then set the style of those elements to display: none. Wondering if there is another way with CSS in the iframe of some other method. I don't think there is an easy way or any way to do it from the parent.
I know that doing this with javascript is problematic due to security restrictions. I don't have easy access to the iframe code but I might be able to add something as it is on the Point2 realestate site and there might be a way to add content but I think I would have to add some javascript.
If so, maybe there would be a way to just check if there is a parent frame and if the parent frame is my frame. I could then set the style of those elements to display: none. Wondering if there is another way with CSS in the iframe of some other method. I don't think there is an easy way or any way to do it from the parent.
ASKER
Can you elaborate on the first option. I am using PHP. Is this pretty much like using a proxy?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry about that, just ignore the reference to the url on there, ive been looking at there e-commerce cart today and thought id test this script on them for a second, its not important to the script anyway.
basicly you would replace that url with the one you want to use,
and then add the css into the $css var.
basicly you would replace that url with the one you want to use,
and then add the css into the $css var.
ASKER
I like that.
Other than this, i found a site asking what i think is the same question and they have several ideas on there.
http://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe