breautek commented on issue #1440:
URL: https://github.com/apache/cordova-ios/issues/1440#issuecomment-2163020661

   I'm not really sure, but I definitely don't reproduce this though I don't 
use the VueJS framework as well. So I think this is more of a VueJS integration 
issue. It is possible that it assumes are more traditional web environment 
where you have a server, with a domain, etc... These things doesn't necessary 
exist in a webview environment.
   
   Couple of things you can try:
   
   ### Enabling url schemes
   
   iOS webview has a concept of schemes, by default has this disabled. This 
means that you're web app is loaded over the `file://` protocol, which the 
means the document has a `null` origin, and the webview considers the document 
insecure and will disable a lot of different features.
   
   If you add a `platform` block in your config with the `scheme` and 
`hostname` preferences, it will enable the url scheme, which means you're 
document will be proxied through something that looks like a server and the 
document will have a proper origin and will be considered secure, for the 
purposes of enabling features locked normally locked behind https.
   
   ```xml
   <?xml version='1.0' encoding='utf-8'?>
   <widget id="com.helloworld.app" version="1.0.0" 
xmlns="http://www.w3.org/ns/widgets"; 
xmlns:cdv="http://cordova.apache.org/ns/1.0";>
     <name>HelloWorld</name>
     <description>Sample Apache Cordova App</description>
     <author email="d...@cordova.apache.org" href="https://cordova.apache.org";> 
Apache Cordova Team </author>
     <content src="index.html" />
     <allow-intent href="http://*/*"; />
     <allow-intent href="https://*/*"; />
     <platform name="ios">
       <preference name="scheme" value="app" />
       <preference name="hostname" value="localhost" />
     </platform>
   </widget>
   ```
   
   Couple of things to note:
   
   1. We use the platform block because android also accept these preferences 
for their equivalent system, but iOS and android has different requirements 
where Android only accepts `http` or `https` as the scheme and iOS requires you 
to use a non-reserved scheme where `http` and `https` are 
[reserved](https://github.com/WebKit/WebKit/blob/ba2a851809a33013068ec8511883055cabd239be/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm#L222-L244).
 This is why we choose something more custom, like `app` for our ios scheme.
   
   2. Android defaults to `https://localhost` as the scheme instead of the 
`file://` protocol strategy, which may explain why VueJS works under the 
android webview out of the box.
   
   ### Possibility of finding more insights
   
   If the above fails... then we probably need to get more insights. I think on 
iOS, xcode will still log JS console messages, but if it is a message from JS, 
the web inspector may have more insightful information.
   
   If you don't know how to use the Safari remote inspector, I have a [blog 
post](https://breautek.com/articles/debugging-cordova-apps.html) that describes 
how, just scroll down to the iOS section.
   
   The key thing though is safari web inspector doesn't capture events that 
occurred before the inspector was attached, so in order to see log messages, 
network errors, or any debug information that occurred on launch, you'll need 
to refresh the webview with the inspector attached. This can be done by 
pressing `cmd` + `r` on the inspector window.


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to