简体   繁体   中英

iFrame Window Height Cross-Domain (request from host website)

I have a website iFramed

<iframe name="ifra" src="" frameborder="0" width="100%" height="800"></iframe>

The host of the website is trying to manipulate the iFrame height on my website (which is actually a good thing)

how would i allow it to do so?

I get this error in firefox console;

Permission denied for <http://idx.themls.com> to get property Window.setIframeHeight
else parent.setIframeHeight('docFrame'); 

Here are the associated lines from the jS file;

    function goSetHeight() {
if (parent == window) return;
// arg: id of iframe element this doc is to be loaded into
else parent.setIframeHeight('docFrame');
} 

As far as i know, this is not possible , as it is imposed as a security restriction . Imagine if a iframe you included on a page could effectively replace your page if it so desired! However, if you have access to the source of the other site, or, a way to contact the developers of the other site, you can get around this restriction using postMessage() on the parent site and the child site, and have the parent set the size of the child based on it's request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM