cordova-plugin-wkwebview-engine icon indicating copy to clipboard operation
cordova-plugin-wkwebview-engine copied to clipboard

iframe contexts inaccessible

Open Zorgatone opened this issue 9 years ago • 4 comments

I have an iframe within my app. It was working with UIWebView.

but now with WKWebView it gives me the error Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match. when I try to access window.top from the inner iframe

Zorgatone avatar Sep 01 '16 11:09 Zorgatone

@Zorgatone related https://github.com/driftyco/cordova-plugin-wkwebview-engine/issues/3 ? it could be a server-side issue due CORS

manucorporat avatar Sep 12 '16 17:09 manucorporat

@manucorporat No. Both the html pages are local (and loaded with file:// by Cordova), and that's where the "null" origin part of the error comes. Basically the page within the iframe can't access the context of the "top window", because of "different origins. Altough there is no "origin" on local files and it shows as "null". The weird part is that "null" is not equal to "null", the error log says..

Zorgatone avatar Sep 12 '16 22:09 Zorgatone

We also experience issue with iFrame from local source not loading with origin error message. Inspecting in Safari debugger, parent document.origin = 'file__0'.

michaelpeterlee avatar Dec 07 '16 20:12 michaelpeterlee

iFrame initialises before being subsequently denied. Could be this WebKit issue: https://issues.apache.org/jira/browse/CB-11885?jql=project%20%3D%20CB%20AND%20labels%20%3D%20wkwebview-known-issues

michaelpeterlee avatar Dec 11 '16 23:12 michaelpeterlee