Tom
Tom

Reputation: 8127

Excluding bootstrap.html or index.html from the history stack with jQuery mobile

I'm creating a mobile application using jQuery mobile and PhoneGap.

When the application is started, the frontpage will be loaded dynamically. What frontpage will appear depends on certain states, for example whether the app has been configured.

This is why I have a bootstrap.html, which only loads all code and has no body. Some logic then calls jQuery.mobile.changePage to load the desired frontpage.

The issue is that bootstrap.html, which is empty, will be put in the application's history stack. When the user then presses the back button, he or she will go to this empty bootstrap page. This is undesirable behavior.

Is it possible to exclude this bootstrap file from the history stack with jQuery mobile?

Upvotes: 0

Views: 465

Answers (1)

frequent
frequent

Reputation: 28503

Without looking into further detail, you would have to disable "hashing" on your first changePage call loading the whatever-page.

If you check the changePage function in JQM.js (RC1.0 line#3041), there are a number of options specified, which you can set on your changePage call. You can also add options if those given don't suffice.

Try if setting option changeHash:false in your changePage call will work (I guess it should). Should be something like this:

$.mobile.changePage( href, { transition: transition, reverse: reverse, role: role, changeHash:false } );

Does this work?

Upvotes: 2

Related Questions