if the iframe is of another domain, can I get its content?
Jump to turn (10)
- 1if the iframe is of another domain, can I get its content?
- 2what do you mean by "control both the parent page"?
- 3can you show me example of an iframe sending message via postMessage to the main
- 4great! I managed to get the gradio-app from the iframe. how can I read its conte
- 5I manage to get the gradio-app element, but then when I try to access its conten
- 6still not working. do you have another idea?
- 7Given the following element, how can I get the elements with data-testid="bot"?
- 8Given the following element, how can I get the elements with data-testid="bot"?
- 9How can I find this element with javascript, without its dependecies? I'm happy
- 10What should be the selector?
- User
if the iframe is of another domain, can I get its content?
- Assistant
No, you generally cannot directly access the content of an iframe if it is of another domain due to the same-origin policy enforced by web browsers. The same-origin policy is a security feature that prevents web pages from making requests to a different domain than the one that served the web page. The same-origin policy restricts JavaScript code running in the context of one domain from accessing content or interacting with content from another domain. This includes accessing the DOM (Document Object Model) or contents of iframes that belong to different domains. However, there are some exceptions and workarounds: