Closed evo-dh closed 3 years ago
@evo-dh This plugin right now doesn't support to extend the solution to iframes.
In case anyone else stumbles upon this issue and wants this plugin to work in an iframe, here's how I did it.
In our case, the iframe was simply another html file in the www/ directory, but both the main app and the iframe make AJAX requests to our server. The iframe was not using the plugin but making direct requests and that didn't work (didn't have the cookies, was using CORS).
The solution turned out to be simple in our case. In the iframe, we just make sure to reference the XMLHttpRequest object that this plugin polyfills.
window.XMLHttpRequest = window.parent.XMLHttpRequest;
I want to access elements of our website that is embedded in a iframe of our ios App. It has the same problem as file access. SecurityError: Blocked a frame with origin "file://" from accessing a cross origin frame...
Is it possible to add the functionality of this plugin for iframes? The only other solution is to set-up a web server locally. Like here: https://stackoverflow.com/questions/59158823/unable-to-post-message-to-file-recipient-has-origin-null-on-cordova-wkwebvi But this solution is not great.