简体   繁体   中英

Getting a secure origin with a custom cordova scheme

Using a cordova plugin that I wrote here: Cordova Protocol Plugin , I've been using a custom scheme (eg my-plugin://) to deliver the web contents of my webview through cordova.

It simply intercept the request and reads from the disk the file instead of hitting the network to support offline content delivery.

My app also uses WebCrypto for some authentication bits but I've been hitting an error telling me:

Only secure origins are allowed

I understand the WebCrypto API requires being in a secure context (Delivering content through HTTPS), but I'm not even hitting the network with my custom protocol.

Is there a way to register my scheme as secure through android's WebChromeClient or WebViewClient? (Like it can be done with electron's Protocol API )

If android does not expose a way to make my scheme secure, is there a way to deliver offline content with a scheme considered secure? (And I'd rather not have to implement a local web server running in the background to use localhost).

There is no way to register your scheme as secure. I believe your stuck with the local web server option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM