简体   繁体   中英

Redirecting Cordova webview to external site

I want to build a simple app container for a website using Cordova. I found this tutorial, which seems very helpful, but wasn't able to connect the app to my website server.

I tried many Cordova's permission settings inside the config.xml and had a look on some Stackoverflow posts like this and this , but neither of those solved my problem. None of them provided the redirection I wanted.

I don't want to use the inappbrowser plugin.

The answer to my problem was a one liner that took three hours of my life.

After creating a Cordova project from scratch, inside config.xml you'll find the following line:

<content src="index.html" />

Simply replace index.html with the site you want the app to be redirected to. For example:

<content src="http://www.google.com/" />

I'm not sure if that makes the final app insecure, though, but it works. I can finally easily embed any site into a Cordova app and build an APK with it.

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