Link to home
Create AccountLog in
Avatar of expertis
expertisFlag for United States of America

asked on

Can I change CSS of html document loaded through iFrame

I have an html document that has an iframe which is loading a complete html document which has the html, head and body tags. I can't seem to get the right selectors to make changes to this document in the iframe. Is it possible to change this document loaded through an iframe?

Here is an example of what I've tried;
#content .column#Middle iframe#results-iframe div#SearchResultsPageNavigatorShell .SearchResultsPageNavigatorShell

I've tried lot's of other variations with no success. I would appreciate any direction someone could provide.

Thanks,
Spencer
ASKER CERTIFIED SOLUTION
Avatar of kebabs
kebabs
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I've been able to change some elements of an iframe from the parent page, but not others, specifically the head contents.  If there are tags in the body with IDs, or form fields, you can generally change them but as mplungjan said, the pages need to be on the same server.  i.e. you cannot change the appearance of -- www.google.com just because you embed it into your iframe !!
Avatar of expertis

ASKER

Thanks for the responses. It is a remote server (not the same domain), so it looks like I will need to fetch the contents using PHP for parsing and insertion into my local html document.

Thanks.
1. please be aware of copyright issues
2. You may be able to get the contents from the other site with their cooperation (rss/javascript/WebService+JSON)
Thanks for the follow-up. The page being retrieved is results data we are paying to have listed on the remote site. That company wants us to use their data, they just don't make it very flexible. Unfortunately the company doesn't yet offer webservices, RSS or JSON.

Thanks.