开发者

Showing content from other domain

开发者 https://www.devze.com 2023-03-12 15:44 出处:网络
A web site makes available to me a reader to show content on my site. They provide me with the URLs for the content I want to display.The problem is that it does开发者_开发技巧n\'t seem possible for m

A web site makes available to me a reader to show content on my site. They provide me with the URLs for the content I want to display. The problem is that it does开发者_开发技巧n't seem possible for me to apply styles to it.

Here is some code to illustrate what I am doing. The original domain give me PHP urls like this:

http://feed.domain.org/reader.php?date=20110610&type=type&lang=AM

I load this content on an iframe on my page. Then to apply styles to it, I retrieve it to put it in a div like this:

istyled.innerHTML = iframe.contentWindow.document.body.innerHTML;

The content does show in the iframe. But the istyled is blank.

Many questions seem to say that this does happen with content that comes from a different domain. Since that site does make the content available to me. What could I do to show that content with a style that fits my site? Is there a policy that the original domain could specify on their web server or a specific way that it could make the content available to me to be able to do that? Is there anything that I should do from my web server?


You are only taking the content from the body of the source page, you will need to add back in the CSS references declared in the head, or just set the IFRAME src to the page.

0

精彩评论

暂无评论...
验证码 换一张
取 消