开发者

Displaying external site into iframe

I'm developing site which provides allow to display external sites into iframe with extra information, similar to google images.

Displaying external site into iframe

In most cases this works well, but some sites uses开发者_开发技巧 javascripts calls which access to parent frame, that causes "Unsafe JavaScript attempt to access frame with URL" and other errors and these sites doesn't displayed correctly.

Are there any way to fix it at least for some sites? Some kind of sandboxing? Or allowing child frame to access parent? Replace window.top somehow?


You will probably have to make proxy.

<?php
$content = file_get_contents("http://addr.to/your/content.html");
$content = preg_replace("~window\.top.*?~i", "", $content);
echo $content;

but it will be VERY unstable this way!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜