I'm creating an native Android application by using PhoneGap and jQuery Mobile.
When I create a multipaged page, i don't to include the same navigationbar all the time. So I tried to include a (s)html. But it doesn't work. This is what i've tried this far:
<!--#include file="navigation.inc.html" -->
<!--#include virtual="navigation.inc.html" -->
<!--#include file="navigation.inc.shtml" -->
<!--#include virtual="navigation.inc.shtml" -->
This page is not placed on a (web)server. When the navigation.inc.shtml is not a server, is it possible to include the file with html or javascript?
I used the client side javascript code as suggested above from Jhof.
template example for Navigation header:
I've created an initialization function where I call all my init functions as
loadTemplates()
my
initializationFunction
is called frombody.onLoad
event.onLoad
event fire at the end of the html parsing!So it work also at the initial page view.
I was looking to a write-once approach to data-role="footer"s, and got it working as shown below. What I don't like it 1.) its not from an include file so 2.) the navbar code is a bit hard to read and maintain. (This code does NOT go in document.ready.)
the pagecreate event works too.
I'm running into the same issue. As far as I can tell, Android ignores Server Side Includes.
I've been getting close to the answer with
load
based on thisanswer
but I'm taking a slightly different approach:Wherever you need to include an external file:
Then, at the end of my ( multipage ) index.html
The problem is that it doesn't work for the initial page view. Any subsequent pages look great.