Skip to content

(ios) Can't navigate to cdvfile:// with wkwebview #349

Closed
@Lindsay-Needs-Sleep

Description

@Lindsay-Needs-Sleep

Bug Report

When on an https:// page you can't navigate to a cdvfile:// url.

What is expected to happen?

Can navigate to cdvfile:// urls. (This works on Android.)
(Preferably without having to whitelist cdvfile://. Also don't have to do that on Android.)

What does actually happen?

If you have cdvfile:// whitelisted:

2019-08-19 12:17:52.265699-0600 [29175:8991235] Received a navigation start notification.
2019-08-19 12:17:52.270295-0600 [29175:8991235] Failed to load webpage with error: unsupported URL
2019-08-19 12:17:52.270507-0600 [29175:8991235] Failed to load webpage with error: unsupported URL
2019-08-19 12:17:52.270820-0600 [29175:8991235] Received a navigation failure notification. error: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSErrorFailingURLStringKey=cdvfile://localhost/bundle/www/backpack/backpack.html, NSErrorFailingURLKey=cdvfile://localhost/bundle/www/backpack/backpack.html, NSLocalizedDescription=unsupported URL, NSUnderlyingError=0x17e64cb0 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "(null)"}, _WKRecoveryAttempterErrorKey=<WKReloadFrameErrorRecoveryAttempter: 0x17eb5d50>}

If you don't have cdvfile:// whitelisted:
It stops at the whitelist check. (don't have the specific error on hand)

Edit: This is only an issue when also using cordova-plugin-wkwebview-engine

Information

I believe this requires a solution similar to (or in addition to) the solution @guylando wrote in pull request #296

Command or Code

window.location.href = "cdvfile://localhost/bundle/www/backpack/backpack.html"; fails
window.open("cdvfile://localhost/bundle/www/backpack/backpack.html"); fails

Version information

Cordova 9.0.0
cordova-ios 4.5.5
ios 10.3.4

Checklist

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions