-1

I'm using Cordova 5.1.1 and building for Android. I've built a simple application that works great when compiled within the cordova project. Now I'm trying to load the pages externally so that I have more control over the content.

I've added InAppBrowser and the pages load from within my app. The problem is that the page elements are not loading like jQuery Mobile pages but instead without any formatting whatsoever.

How can I load my application like it's intended to while keeping the content external?

Ken J
  • 4,312
  • 12
  • 50
  • 86

2 Answers2

0

InAppBrowser will load your pages into a separate browser instance that's displayed over your Cordova application's WebView, with a 'Done' button to return to the Cordova WebView when you are done. This is normally used for things like following links to external content such as a 3rd party website.

If you want to pull in content from a server that you have control over, use an Ajax request from your Cordova application to get the HTML fragment you want from your server and display it in a div in your Cordova application's DOM. Then either have a stylesheet in your Cordova app that knows what to expect from your external content, so that you have CSS styles for the new content you loaded, or pull in the CSS files you need and append them to your document's head. JQuery Mobile has more information here.

Community
  • 1
  • 1
Simon Prickett
  • 3,838
  • 1
  • 13
  • 26
0

@Ken,
First, I understand your question, but it has misconceptions.

  1. What you are suggesting - can be done.
  2. It goes against the architecture of the system.
  3. If you want to do this, you need a really good reason.

Again the answer to your question is YES, but you are heading for a world of hurt.

Next, I suggest you read more about Cordova/Phonegap, and SPA (Single Page Applications), which you will likely implement.

Also, the normal methodology is to store ALL assets locally, and only load remotely what needs to be. (such as from a database records).

Lastly, if you have more questions, unless they are directly related, please ask on a new thread.
--Best of Luck