开发者

loading html content into iframe fails in Chrome

开发者 https://www.devze.com 2023-01-31 00:21 出处:网络
I have made an HTML page with the following jQuery script. function clickbutton() { frameContent = $(\'#iframeID\').contents().find(\'body\').html();

I have made an HTML page with the following jQuery script.

function clickbutton() {
 frameContent = $('#iframeID').contents().find('body').html();
 $("#paste").html(frameContent);
}

And the following HTML:

This 开发者_JAVA技巧is a page with an IFRAME.<br>
<IFRAME id="iframeID" src="otherpage.html" height="600" width="600"></IFRAME><br>
<input type="button" value="click" onclick="clickbutton()"/><br>
<div id="paste"></div>

The script reads the content of the otherpage.html when the button is clicked. This works perfectly in IE and Firefox, but not in Chrome.

Why is this not working in Chrome, and are there any workarounds?


this seems to work for me: http://www.jsfiddle.net/d6SNB/2/

0

精彩评论

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