Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load a local URL or html file in Corodva iOS with inAppBrowser #657

Open
3 tasks
ash67 opened this issue Mar 27, 2020 · 2 comments · May be fixed by #778
Open
3 tasks

Unable to load a local URL or html file in Corodva iOS with inAppBrowser #657

ash67 opened this issue Mar 27, 2020 · 2 comments · May be fixed by #778

Comments

@ash67
Copy link

ash67 commented Mar 27, 2020

Bug Report

Problem

What is expected to happen?

What does actually happen?

I have recently upgraded to Cordova InAppBrowser plugin to 3.2.0 which uses wkwebview to render HTML content. I have always been able to load local HTML file by using the following the code:

 cordova.InAppBrowser.open(
          'cdvfile://localhost/bundle/www/assets/index.html',
          '_blank',
        );

However, wkwebview doesn't support 'cdvfile' so I tried using the relative file as below

 cordova.InAppBrowser.open(
          'assets/index.html',
          '_blank',
        );

This approach is not working either. The inAppBrowser opens and shows HTML Error 403: forbidden. After I close the browser, all the local files like IMG becomes unavailable and browser console [Error] Failed to load resource: the server responded with a status of 403 (Forbidden). I don't understand why closing browser cause other local files become accessible.

Information

Command or Code

Environment, Platform, Device

I m using the cordova-plugin-wkwebview-engine plugin which forces to use WKwebview. here are the configs

<preference name="WKWebViewOnly" value="false" />
        <feature name="CDVWKWebViewEngine">
            <param name="ios-package" value="CDVWKWebViewEngine" />
        </feature>
 <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

Version information

Cordova ios: 5.1.1
ios: 13.4
Cordova: 9.0

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@dpalou
Copy link
Contributor

dpalou commented May 8, 2020

I have the same issue. Using "cdvile" scheme gives me an "unsupported URL" error, while using the "file" scheme gives me the following error:

webView:didFailProvisionalNavigation - 1: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 1.)

I opened a PullRequest to fix opening files with the "file" scheme with WKWebView:

#693

Since I don't want to use a fork in my project, for now I'll use a workaround to avoid loading local files in InAppBrowser in my app, I hope this is fixed soon :)

@guycalledseven
Copy link

@dpalou thank you for the update, I created another another pull request so loaded html could load it's external resrouces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants