I want to access elements of “iFrame” in a website,
iFrame and the website is different websites
So i am getting this error if i try to access the selector
“document.getElementsByTagName(‘iframe’)[1].contentWindow.document”
Error : Blocked a frame with origin “https://buy.realme.com” from accessing a cross-origin frame
So can we turn this security off in webview of kodular OR any other alternative??
1 Like
The domain has explicitly blocked Cross-Origin requests (CORS), there’s nothing you can do about it.
You can’t access an <iframe>
with different origin using JavaScript, it would be a huge security flaw if you could do it.
Even though same-origin policy blocks scripts from accessing the content of sites with a different origin, if you own both the pages, you can work around this problem using window.postMessage
and its relative message
event to send messages between the two pages