简体   繁体   中英

Visual Studio Apache Cordova browser app

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

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