$.mobile.changePage should be able to pass information into the "data" param of pageshow, pagehide events #5103

asgeo1 opened this Issue Sep 28, 2012 · 3 comments


None yet
4 participants

asgeo1 commented Sep 28, 2012

The pageshow, pagehide, etc events typically have a signature like:

function(event, data){}

But there doesn't seem to be any way to pass information from $.mobile.changePage into that data parameter.

The keys in the data parameter seem to be fixed - you can't add your own keys from what I can see.

I often want to be able to do this:

$myPage.on('pageshow', function(event, data){

$.mobile.changePage($myPage, {message: "my message"});

That's just an example. In practice I'm making single page apps with Backbone.js and need to be able to pass information around like that.

This issue is also similar to #2228, which requested the ability to make callbacks from $.mobile.changePage.

Implementing these features would make it a lot easier for people writing single-page jQuery Mobile apps.


johnbender commented Sep 28, 2012


We do pass along the options object from each call to, data.options since we accept an args param as settings in the call. The events that pass the options in as data are:

  • pagebeforeload
  • pageload
  • pageloadfailed
  • pagebeforechange
  • pagechange
  • pagechangefailed

So a call to changePage like:

$.mobile.changePage( "#foo", { bar: "baz" });

would get data.options.bar == "baz" in each of those events. We just need to include the call options on the transition events it looks like (pagebeforeshow, pagebeforehide, pageshow, and pagehide).

johnbender was assigned May 29, 2013

Ruffio commented Dec 30, 2014

@arschmitz, @johnbender Is this still relevant?


arschmitz commented Dec 30, 2014

@Ruffio no that method is deprecated as well as those events if any one wants this with the new methods and events that should be a new issue.

arschmitz closed this Dec 30, 2014

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