Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Navigating back to a previously rendered page does not fire an event #48

blowsie opened this Issue Jun 13, 2012 · 6 comments


None yet
2 participants

blowsie commented Jun 13, 2012

When navigating from mysite.com/index.html#page-name to mysite.com/index.html#page-name?info the routers are fired, however when navigating back, using the browser back button no events are fired.

Is the intended outcome?
Is there a work around?

Only all of my pages are templated and I have no way of re-rendering them when navigating backwards through the site.

blowsie commented Jun 13, 2012

my, bad, i was using the wrong event , i needed to use the beforechange (bC) event

@blowsie blowsie closed this Jun 13, 2012


azicchetti commented Jun 13, 2012

Hi @blowsie ,
there's a test file covering this scenario under examples: testBackButton.html

As far as I know, it should work with jquery mobile 1.1.0 and jquery 1.7.1 / 1.6.4.

Could you please explain whether your case differs from that one, possibly providing some source code?

Thank you


azicchetti commented Jun 13, 2012

Uhm, using bC is not recommended (it should be used only to do very particular things in jquery mobile), if you need to resort to that event there's probably something wrong.

Page transitions triggered by the back button can be handled with pagebeforeshow and pageshow

@blowsie blowsie reopened this Jun 13, 2012

blowsie commented Jun 13, 2012

When navigating from mysite.com/index.html#page-name to mysite.com/index.html#page-name?info there is a page transition, but when you use the back button there is no transition, why is this?

blowsie commented Jun 13, 2012

My case differs from the example testBackButton.html as follows.

testBackButton.html navigates from testBackButton.html#page to testBackButton.html#page2,

my example navigates from mysite.com/index.html#page-name to mysite.com/index.html#page-name?info

notice how on my version the hash remains the same but im adding a parameter / search ?info on my url, it is when navigating backwards to#building-info that the problem occurs

I have uploaded a file to demonstrate the issue.

Drill all the way down to the last page and then navigate backwards.


azicchetti commented Jun 13, 2012

I see, when the application transitions back from #something?param to #something, the allowSamePageTransition is not set by the router and jquery mobile doesn't fire any event.

Replace the following line in the router

if ( u.hash.indexOf("?") !== -1 ) {


if (    u.hash.indexOf("?") !== -1 ||
        (u.hash.length>0 && previousUrl!==null && previousUrl.hash.indexOf(u.hash+"?")!==-1)
) {

It's a very specific patch so it shouldn't compromise the router stability.
However, I have to do some more tests before officially pushing it to the git.

Thank you very much for finding this obscure bug!

azicchetti added a commit that referenced this issue Sep 3, 2012

Fixed the issue #48.
Support for form submission was added in order to handle GET parameters

@azicchetti azicchetti closed this Sep 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment