You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/06/22 20:37:25 UTC

[GitHub] [cordova-android] AshleyScirra opened a new issue #1004: Support on Android

AshleyScirra opened a new issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004


   # Feature Request
   
   As of cordova-ios 6.0.0, you can use the following in config.xml:
   
   ```xml
   <preference name="scheme" value="app"/>
   <preference name="hostname" value="localhost"/>
   ```
   Then the app runs on app://localhost instead of file://. This does not appear to work on Android though - having tried it the app still runs at a file:// URL.
   
   ## Motivation Behind Feature
   Running on file: brings a number of origin-related problems. Notably on file:, the browser treats every resource as a different origin, causing some features to be blocked. In particular, `fetch()` cannot be used at all, because it's actually written in to the specification that it should throw on file: protocol.
   
   Further, this will allow Cordova Android apps to more closely align their codebases with iOS, since in both cases it can be running on the same URL (app://localhost) with identical capabilities regarding the security origin, use of `fetch()`, etc.
   
   ## Alternatives or Workarounds
   Right now we are forced to use cordova-plugin-file to read local files, and in many cases use some ugly code involving blobs and blob URLs to work around restrictions with file: URLs. We also have to maintain two significantly different codepaths, one using `fetch()`, the other using cordova-plugin-file methods.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] AshleyScirra commented on issue #1004: Support custom scheme or domain for local content on Android

Posted by GitBox <gi...@apache.org>.
AshleyScirra commented on issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004#issuecomment-743149387


   Note: this may also be necessary to support JavaScript Modules (#1142).


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] breautek commented on issue #1004: Support custom scheme or domain for local content on Android

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004#issuecomment-649892156


   > But even that, I don't think it should be in cordova-android for now, should start as a separate plugin as cordova-plugin-wkwebview-engine and if people uses it, integrate it in cordova-android later on.
   
   Just noting that a solution like this should solve https://github.com/apache/cordova-android/issues/560 ... where the current workaround is to use the ionic webview.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] brodybits commented on issue #1004: Support custom scheme or domain for local content on Android

Posted by GitBox <gi...@apache.org>.
brodybits commented on issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004#issuecomment-648877829


   > host on a custom local domain, e.g. `https://cordova.local`.
   
   Or maybe use `.localhost` tld for an extra 0.001 % safety factor ref:
   
   - https://en.wikipedia.org/wiki/.localhost
   - https://en.wikipedia.org/wiki/.local
   
   > It seems odd to use https without a certificate
   
   Maybe use http scheme?


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] jcesarmobile commented on issue #1004: Support custom scheme or domain for local content on Android

Posted by GitBox <gi...@apache.org>.
jcesarmobile commented on issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004#issuecomment-859659991


   [This PR](https://github.com/apache/cordova-android/pull/1137) that uses the `WebViewAssetLoader` will allow to load apps from `https`, the `<preference name="hostname" value="localhost"/>` will be available, the scheme will not, will always use `https`.
   
   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] jcesarmobile closed issue #1004: Support custom scheme or domain for local content on Android

Posted by GitBox <gi...@apache.org>.
jcesarmobile closed issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004


   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] jcesarmobile commented on issue #1004: Support on Android

Posted by GitBox <gi...@apache.org>.
jcesarmobile commented on issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004#issuecomment-648765122


   Google engineers have recommended to discourage custom schemes in Android apps in [this ionic webview issue](https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/484), so I don't think this is something we should do in cordova-android.
   
   
   But maybe, as ionic webview does, intercept the requests so they load as http/https urls. That should fix some of the mentioned problems.
   
   But even that, I don't think it should be in cordova-android for now, should start as a separate plugin as cordova-plugin-wkwebview-engine and if people uses it, integrate it in cordova-android later on.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] dpogue commented on issue #1004: Support custom scheme or domain for local content on Android

Posted by GitBox <gi...@apache.org>.
dpogue commented on issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004#issuecomment-648882082


   A few notes:
   
   * The `WebViewAssetLoader` option mentioned by the Google folks requires using the AndroidX WebView, not the built-in WebView.
   * The default/suggested URL origin for `WebViewAssetLoader` is `https://appassets.androidplatform.net`
   * No certificate is needed for HTTPS because it's intercepted on the device before a request is made
   * HTTPS is encouraged because lots of web platform functionality is being disabled for non-secure origins


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] AshleyScirra commented on issue #1004: Support on Android

Posted by GitBox <gi...@apache.org>.
AshleyScirra commented on issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004#issuecomment-648859023


   Ah, I see, interesting.
   
   It sounds like an alternative could be to host on a custom local domain, e.g. `https://cordova.local`. I imagine this then makes it clear whether the request should be served locally by matching the `cordova.local` domain on the request, and then everything is still treated as same-origin and using the well-defined and stable `https` scheme. (Would that work? It seems odd to use https without a certificate, but if that will do the job then I think it's fine)
   
   The real motivation here is to not use `file:` due to the cross-origin obstacles it would throw in the way, so a custom domain on https would still solve the original problem. So could that work instead?
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] AshleyScirra commented on issue #1004: Support custom scheme or domain for local content on Android

Posted by GitBox <gi...@apache.org>.
AshleyScirra commented on issue #1004:
URL: https://github.com/apache/cordova-android/issues/1004#issuecomment-648882208


   A key detail is the webview should still think the page is in a secure context, since some features are gated behind that. I'm not sure if a URL like `http://cordova.localhost` will quality as a secure context. If it does not it would be preferable to use `https`.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org