studioromeo opened a new issue #863:
URL: https://github.com/apache/cordova-plugin-inappbrowser/issues/863
# Bug Report
## Problem
I'm not sure if this should have worked to begin with but I was hoping to
use the in app browser to display in memory PDFs. In v4.1.0 this seemed to work
just fine however in v5.0.0 this no longer renders the PDF. I verified this by
switching the plugin between versions and noticing the change in behaviour.
### What is expected to happen?
In v4.1.0 the PDF would render in the in app browser window.
Stack trace:
```
2021-04-08 20:26:30.078627+0100 [656:46453] WF: _userSettingsForUser mobile:
{
filterBlacklist = (
);
filterWhitelist = (
);
restrictWeb = 1;
useContentFilter = 0;
useContentFilterOverrides = 0;
whitelistEnabled = 0;
}
2021-04-08 20:26:30.078706+0100 [656:46453] WF: _WebFilterIsActive
returning: NO
2021-04-08 20:26:30.087310+0100 [656:46453] THREAD WARNING: ['InAppBrowser']
took '19.270752' ms. Plugin should use a background thread.
2021-04-08 20:26:30.172211+0100 [656:46453] No
2021-04-08 20:26:30.183759+0100 [656:46453] didStartProvisionalNavigation
2021-04-08 20:26:30.633742+0100 [656:46453] Unbalanced calls to begin/end
appearance transitions for <UIViewController: 0x106416a40>.
```
### What does actually happen?
In v5.0.0 displays a blank in app browser window. From reading the stack
trace what jumps out at me is WebKitBlobResource (code 1).
Stack trace:
```
2021-04-08 20:17:19.278086+0100 [637:43483] WF: _userSettingsForUser mobile:
{
filterBlacklist = (
);
filterWhitelist = (
);
restrictWeb = 1;
useContentFilter = 0;
useContentFilterOverrides = 0;
whitelistEnabled = 0;
}
2021-04-08 20:17:19.278183+0100 [637:43483] WF: _WebFilterIsActive
returning: NO
2021-04-08 20:17:19.281601+0100 [637:43483] THREAD WARNING: ['InAppBrowser']
took '12.166016' ms. Plugin should use a background thread.
2021-04-08 20:17:19.362538+0100 [637:43483] No
2021-04-08 20:17:19.362796+0100 [637:43483] didStartProvisionalNavigation
2021-04-08 20:17:19.372718+0100 [637:43483] [Process] 0x13c08f018 -
[pageProxyID=22, webPageID=23, PID=642]
WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain =
WebKitBlobResource, code = 1
2021-04-08 20:17:19.373055+0100 [637:43483]
webView:didFailProvisionalNavigation - 1: The operation couldn’t be completed.
(WebKitBlobResource error 1.)
2021-04-08 20:17:19.823854+0100 [637:43483] Unbalanced calls to begin/end
appearance transitions for <UIViewController: 0x13be59db0>.
2021-04-08 20:17:45.559624+0100 [637:43483] Could not signal service
com.apple.WebKit.WebContent: 113: Could not find specified service
```
## Information
<!-- Include all relevant information that might help understand and
reproduce the problem -->
I think the below code should be all thats needed. You'll need to grab the
contents of a PDF and initialise `pdf` with that.
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
```js
const blob = new Blob([pdf], {type:'application/pdf'});
const url = URL.createObjectURL(blob);
window.cordova.InAppBrowser.open(url, '_blank');
```
From reading around
https://github.com/mozilla/pdf.js/issues/8152#issue-213375356 it seems that
using blobs is unreliable in iOS safari and I guess the in app browser was
using wkwebview before which is why this wasn't exhibited before?
Hopefully thats enough info to go on but if you need any more info let me
know. I did try and find what was going on myself but I'm a bit out of my depth
here 😓
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you
experiencing the issue? -->
iOS 14.4.2
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
cordova-plugin-inappbrowser: 5.0.0
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]