Skip to content

Commit cbf0e88

Browse files
committed
Proxy only on non standard schemes
Proxying http and https via `convertFileSrc` only works on Android where the webview runs on custom schemes.
1 parent 6374b87 commit cbf0e88

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/www/util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ var exec = require('cordova/exec');
22

33
var WebView = {
44
convertFileSrc: function(url) {
5+
const convertHttp = !location.protocol.startsWith("http") && !location.protocol.startsWith("https")
6+
57
if (!url) {
68
return url;
79
}
@@ -11,10 +13,10 @@ var WebView = {
1113
if (url.startsWith('file://')) {
1214
return window.WEBVIEW_SERVER_URL + url.replace('file://', '/_app_file_');
1315
}
14-
if (url.startsWith('http://')) {
16+
if (url.startsWith('http://') && convertHttp) {
1517
return window.WEBVIEW_SERVER_URL + url.replace('http://', '/_http_proxy_');
1618
}
17-
if (url.startsWith('https://')) {
19+
if (url.startsWith('https://') && convertHttp) {
1820
return window.WEBVIEW_SERVER_URL + url.replace('https://', '/_https_proxy_');
1921
}
2022
if (url.startsWith('content://')) {

0 commit comments

Comments
 (0)