How to open another HTML file by default – PhoneGap app In Windows Phone

About PhoneGap, I am just adding  few words :-

We all now, PhoneGap in supporting For Windows Phone, almost there is full support for accessing native functionality. Just from the HTML5, CSS3 and Javascript files. This is really powerful framework, Using this framework web developers can build native mobile apps for iOS, Android, Blackberry, Windows Phone and other smartphone OS devices as well.

It works How? :- PhoneGap is loading our HTML files in WEB view controller and access native functionality using ScriptNotify and receiving data InvokeScript, (just in windowsphone but same way in other devices also) it’s awesome!.

PhoneGap Logo with Windows Phone Android iOS Bada Blackberry
PhoneGap Logo with Windows Phone, Android, iOS, Bada, Blackberry

How to set start page in Phonegap, Windows Phone? :-

Coming to the point, When we run PhoneGap app in windows phone or any other OS it is automatically pointing to index.html file. Sometimes we need to point to some other page. May be we want to show some flash screens or Demo video page something So, we need to point to differentiate page, which is not name as an index.html. This we can do very easily no need to write much code and also no need to redirect using JavaScript in index.html.

There is a property called StartPageUri of  Cordova View controller (PGview controller). We can set a start page using that. PhoneGap framework made it easy. Thank you PG!

Here is the Example code :-

public partial class MainPage : PhoneApplicationPage
{
//variables…..
public MainPage()
{
InitializeComponent();
PGView.StartPageUri = new Uri(“/app/www/blogs.html“, UriKind.Relative);  //Here is the magic code, just one line
:

Remember we can also access PGview’s browser controller, Just like this PGView.Browser.

Leave a Reply