apache / apache/cordova-plugin-inappbrowser

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

Open
#657 2 comments 5 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.1k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

# 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

```





```

### 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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with cordova.InAppBrowser.open using both the cdvfile URL and the relative assets/index.html URL under the supplied WKWebView configuration. Inspect the InAppBrowser and WKWebView handling of local URLs; done means the HTML file and its local resources load without 403 errors and remain accessible after closing the browser.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.