oracle / cordova-plugin-wkwebview-file-xhr

Cordova Plugin for WebView File XHR
Universal Permissive License v1.0
138 stars 120 forks source link

Unable to post message to file://. Recipient has origin null. #56

Closed w4ugit closed 4 years ago

w4ugit commented 4 years ago

I have an application written on vue. It worked until I switched to WkWebView. Then I started to get this error - Unable to post message to file: //. Recipient has origin null. Installing your plugin did not help. Do I have to do anything else in my code?

marcossantana commented 4 years ago

I'm getting the same error. Someone fixed it?

manish2788 commented 4 years ago

@w4ugit What version of cordova you are using? Can you furnish more detail about your project setup.

marcossantana commented 4 years ago

@manish2788 can we talk about this? using email or skype? i can pay from your support.

manish2788 commented 4 years ago

@marcossantana Please share the detail of your setup.

marcossantana commented 4 years ago

I have some specifics features. If it is possible, i would talk privating with you.

ej-dunne commented 4 years ago

I had a similar problem, searched everywhere and couldn't find an answer, but this worked. Either create a plugin that does the following or add it to your existing code

Add the following to your header:

import <WebKit/WebKit.h>

import <Cordova/CDV.h>

Then the following to your code:

NSLog(@"Updating webview to allow local file access"); WKWebView wkWebView = (WKWebView ) self.webViewEngine.engineWebView [wkWebView.configuration.preferences setValue:@YES forKey:@"allowFileAccessFromFileURLs"];

To clarify the error I was getting had to do with a cross origin issue due the the null origin in the request from file:// so I am not 100 percent sure that this will work but it might be worth a try

manish2788 commented 4 years ago

Closing this issue as not response received from issue filer.