Tom Schreck
Tom Schreck

Reputation: 5287

accessing website using PhoneGap

I have a client web app (Html 5, CSS, JQueryMobile, etc) that's being generated by ASP.Net MVC. I'm using ASP.Net MVC to identify the user agent as a traditional browser, or a mobile browser. If mobile browser then I render mobile views. The app is working as designed when accessed via a browser on a desktop, or a browser on a mobile device (iPad and Android tablet).

The client wishes to wrap their app in PhoneGap so they can create distributables for Google Play and Apple store. I'm relatively new to PhoneGap, so the approach I've taken is to create a stripped down html page with an iframe that accesses the URL for said application. My intent is to use Dreamweaver CS 5.5 and PhoneGap to generate the APK file and iPad equivalent so we can load the client's app into the different mobile stores.

I'm not sure if this approach is correct. It seems like it should work: a stripped down index.html page that only has an iframe that calls the app. Here's the code:

<html>
<head>... phoneGap.js..</head>
<body style="margin:0px;padding:0px;overflow:hidden">
    <iframe src="[URL TO WEBSITE HERE]" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px" height="100%" width="100%"></iframe>
</body>
</html>

I've created an APK file using the code above and have loaded it in an Android tablet running IceCreamSandwhich, but the performance is horrible. However, I can access the app via browser on same Android tablet and everything works as designed.

Can someone please point me in the right direction on how to get this to work. I can't change ASP.Net MVC. There has to be a way to get a mobile app generated by ASP.Net MVC packaged so it can be put into Google Play and Apple Store.

Upvotes: 1

Views: 762

Answers (1)

purplecabbage
purplecabbage

Reputation: 495

You will most likely not be able to make it work the way you have it because the phonegap.js is not accessible to code running in an iframe.

You could redirect the index page to your server, BUT there is a strong likelihood that Apple will not allow you to distribute this through their app store. This would also require you to place the phonegap/cordova js file on your server.

A 'typical' phonegap/cordova app has resources that live on the client ( they are packaged into the application ) and the server is only there to provide data, typically via a REST+JSON api.

What you sound to be building is a wrapped website, which IMHO is not an app, and should just be used in the browser.

Upvotes: 1

Related Questions