简体   繁体   中英

JS/jQuery Accessing iframe elements cross domain (but the js file is the same domain)

I have a page (different domain) with an external js file that lives on the same domain as an iframe that is also on the page... can this js file access contents in this iframe since they are sitting on the same domain? Or is that still not possible?

Thanks!

It does not matter what domain the JS files are on, only the domain of the web pages / frames.

Here's an MDN reference on the same-origin policy for more detailed info.

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