2012-07-05 85 views
0

嗨,我想它的内容的iframe调整与JavaScript

frame = document.getElementById(frameId); 
    innerDoc = frame.contentWindow.document; 
    objToResize = (frame.style) ? frame.style : frame; 
    objToResize.height = innerDoc.body.scrollHeight + 10; 

调整大小的iframe但是当iframe是上其他域,我得到

Unsafe JavaScript attempt to access frame 

是否有任何其他方式做到这一点?

+0

可能重复http://stackoverflow.com/questions/5660116/unsafe-javascript-attempt-to-access-frame-in-google -铬) – antyrat 2012-07-05 10:56:53

回答

0

请参阅以下用于跨域Iframe调整大小的链接;

cross-domain-iframe-resizing

[不安全的JavaScript尝试在谷歌浏览器来访问帧(的