-2

I have an iframe tag, where I wish to change the font-family. But the iframe I am linking to does not have a body, it's just text and pictures. So most javascript ways of accessing it don't work. Is there any way around it?

Nicolaid
  • 65
  • 2
  • 6

2 Answers2

2

If the iframe isn't on the same domain as its parent, there's nothing you can do to modify its contents, because of the same-origin policy.

Elliot Bonneville
  • 51,872
  • 23
  • 96
  • 123
0

If the iFrame is not on the same URL / server, the best way for you do this is with PHP instead.

<div class="iframe">
    <?php echo get_file_contents("http://www.google.com"); ?>
</div>
<style>
    .iframe {
        !! Whatever Styles !!
    }
</style>

Obviously replacing !! Whatever Styles !! with the changes you wish to make to the font. I hope this helped - I'm quite new to Stack Overflow, so if I'm doing anything wrong please tell me :)

VCNinc
  • 747
  • 1
  • 9
  • 25