简体   繁体   中英

iframe cross origin policy in IE

Which versions of IE throw an exception if we try to access the cross origin data ?

IE doesn't throw exception if I call $('iframe[name="iframe"]').contents().find('body') in my javascript code

However, chrome and firefox do

DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://localhost:8080" from accessing a cross-origin frame.(…)

That has been included since IE7.

The reason you're not having any issues with it, is because you've set your privacy settings in IE to allow local and cross domain communication.

There are a few ways to bypass this depending on what you're trying to do.

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