Visual Studio Apache Cordova浏览器应用程序 [英] Visual Studio Apache Cordova browser app

查看:236
本文介绍了Visual Studio Apache Cordova浏览器应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求使用Visual Studio 2015开发一个Apache Cordova应用程序,只需在登录后加载网站,然后网站将根据自己的功能运行。而且该应用需要在Android,苹果& WP。我以为我做了,因为样本是这么简单,但我不能得到它的工作。可以有人请点我的方向示例代码这样做。



我已经尝试过InAppBrowser包,但是它不会加载任何东西,它只是显示一个包含我的命令的页面,没有错误信息。



我也尝试把我的网站放入config.xml中的< content src =index.html/> 部分,甚至不构建。



似乎不像使用IFrame是一个好主意。



帮助将不胜感激。我真的认为这很简单。

解决方案

@Adriaan Davel,好吧。尼斯措辞的职位。非常感谢。



QUOTE


我被要求使用Visual Studio 2015开发一个Apache Cordova应用程序,只需在登录后加载网站,然后网站将按照自己的功能运行。


回复:

不能这样做。不允许。这违背了移动应用程序开发的所有安全协议。您可以使用网络应用而不是移动应用 - 即使使用混合应用(如Cordova / Phonegap)

您最好做的是从*设备*加载网页,然后登录到服务器。您可以与服务器交换数据,但是您不能*从远程网络服务器加载网页–只有一个例外。



一个异常

您可以从网络服务器加载网页 InAppBrowser 插件。在theroy,应用程序可以传递数据到网页,但它不能从网页接收数据。此外,您不能使用任何 Cordova API 。这包括但不限于设备文件地理位置。您可以在他们的位置使用 HTML5 API 搜索) 。同样,您无法访问 Cordova API



这样做的典型方式是使用REST API服务器处理所有移动数据,然后将该数据传递到Web服务器 - 通常通过数据库。关键在于在移动客户端和web服务器之间没有直接通信。网络服务器被认为太不可信。



白名单系统



*全新的*这已经让很多开发者烦恼了。它也绊倒了你。

如何应用Cordova / Phonegap白名单系统

这里有一个小窍门,解释如何临时解决这个问题。

(使用:< preference name =phonegap-versionvalue =3.7.0/>



和示例



我有很多例子,但他们都不是最新的。我最好的例子是这个样板: Phonegap - Generic-Boilerplate5



这是博客文章: Three(3)Phonegap Build Boilerplates for Android and iOS 您要使用Boilerplate5



十(10)Phonegap演示应用程序源代码 < br>这些演示应用已过期。他们需要添加白名单



注意:我有三个博客
一个
两个
三个


I have been asked to develop an Apache Cordova app with Visual Studio 2015 that will simply load a website after login then the website will function as per its own functionality. And the app needs to work on Android, Apple & WP. I thought I had done it as samples are so simple but I cannot get it to work. Can somebody please point me in the direction of sample code that does this.

I have tried the InAppBrowser package but it does not load anything, it simply shows a page with my commands and no error information.

I have also tried putting my website into the <content src="index.html" /> section in the config.xml but then it doesn't even build.

It does not seem like using IFrames are a good idea either.

Any help will be appreciated. I really thought this would be simple.

解决方案

@Adriaan Davel, Okay. Nicely worded post. Thanks for doing that.

QUOTE

I have been asked to develop an Apache Cordova app with Visual Studio 2015 that will simply load a website after login then the website will function as per its own functionality.

Reply:
You can't do that. It is not allowed. It is against all security protocols for mobile app development. You can do this with web app, but not mobile app - not even with hybrid app (like Cordova/Phonegap).

The best that you can do is load a webpage from the *device*, then login to the server. You are allowed to exchange data with the server, but you are *not* allowed to load a webpage from a remote webserver – with one exception.

The One Exception
You can load a webpage from a webserver in the InAppBrowser plugin. In theroy, the App can pass data to the webpage, but it cannot receive data from the webpage. In addition, you cannot use any of the Cordova APIs. This includes, but is not limited to, device, File, and Geolocation. You can in their place use the HTML5 APIs (SEARCH). Again, you have not access to the Cordova APIs

The typical way this is done is to have a REST API server that handles all the mobile data, then passes that data to the webserver - usually through a database. The point being there is no direct communication between the mobile client and the webserver. Webservers are considered too untrustworthy.

The whitelist system

*Brand new* This has been tripping up alot of developers. It tripped you too.
HOW TO apply the Cordova/Phonegap the whitelist system
There is a trick in there that explains how to get around this temporarily.
(Use: <preference name="phonegap-version" value="3.7.0" />)

Code and Examples

I have lots of examples for you, but they are not all up to date. The best example I have is this boilerplate: Phonegap--Generic-Boilerplate5

Here is the Blog Post: Three (3) Phonegap Build Boilerplates for For Android and iOS You want to use Boilerplate5

Ten (10) Phonegap Demo Apps with Source Code
These demo apps are out of date. They need to have the whitelist added.

NOTE: I have three blogs one, two, three.

这篇关于Visual Studio Apache Cordova浏览器应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆