[英]Redirecting Cordova webview to external site
I want to build a simple app container for a website using Cordova. 我想使用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. 我试过很多科尔多瓦的权限设置里面
config.xml
,并且对一些职位#1像一看这个和这个 ,但那些都解决了我的问题。 None of them provided the redirection I wanted. 他们都没有提供我想要的重定向。
I don't want to use the inappbrowser plugin. 我不想使用inappbrowser插件。
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: 从头开始创建Cordova项目之后,在
config.xml
您将找到以下行:
<content src="index.html" />
Simply replace index.html
with the site you want the app to be redirected to. 只需将
index.html
替换为您要将应用程序重定向到的网站即可。 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.
我终于可以轻松地将任何网站嵌入Cordova应用程序并使用它构建APK。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.