views:

24

answers:

2

I have a iframe and want to either get some of the HTML from the page in the iframe or the opportunity to change the HTML on the page in the iframe with jQuery.

I use this code to get content from the iframe:

$('iframe#iframeBB').contents().find('table').each(function() {
 var at = $(this).attr('summary');
 if (at == "Latest Data") {
    $('table#main').html($(this).html());
 }
});

This works fine as long as the source for the iframe is at the same domain. My problem is that the source is on another subdomain. I know this is against the Same-Origin Policy, but is there a way to do this?

A: 

If it's a subdomain, you have to let both work on the same tld, by setting document.domain on your pages.

document.domain = "yourdomain.com"
Mikael Svenson
Thank you! It worked.
Helge
A: 

I think that the only way to do is to get the html output of the page using server side and output it into the iframe.

IgalSt