Cordova将远程站点加载到应用程序中

编程入门 行业动态 更新时间:2024-10-09 05:21:01
本文介绍了Cordova将远程站点加载到应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个网站,我用jQuery和HTML5编码。我想使用一个简单的框架为IOS和Android,我的网站加载到应用程序 - 本质上是一个内部浏览器。点击应用程序中的链接将转到应用程序中的该远程页面。

I have a website that I've coded with jQuery and HTML5. I'd like to use a simple framework for IOS and Android that loads my website into the app - essentially an internal browser. Clicking on a link in the app would go to to that remote page inside the app.

我已经尝试使用Cordova在index.html上设置位置,外部网站进入设备浏览器而不是应用:

I've tried setting a location on index.html using Cordova but it's loading the external site into the device browser and not the app:

<html lang="us"> <head> <meta charset="utf-8"> <title>Test</title> <script src="cordova.js"></script> <script type="text/javascript"> document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { // Now safe to use the Codova API window.location="www.test"; } </script> </head> <body> </body> </html>

如何使用Cordova加载远程站点,所以应用程序本质上是一个Web浏览器?

How can I load my remote site with Cordova so the app is essentially a web browser? Is there a better/easier solution other than Cordova to accompolish this?

推荐答案

安装在应用程序浏览器中

Install In App browser

cordova plugin add cordova-plugin-inappbrowser

然后在代码中

var options = { location: 'yes', clearcache: 'yes', toolbar: 'no' }; $cordovaInAppBrowser.open('yoururlhere', '_blank', options)

有关详情,请参阅 appova中的cordova文档

更多推荐

Cordova将远程站点加载到应用程序中

本文发布于:2023-11-13 11:29:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584237.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   加载   站点   Cordova

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!