views:

136

answers:

1

I am trying to determine the previous page (e.g. the referrer) in order to decide whether to display the back button.

I tried to check for $('.current').data('referrer'), but it is not always set. In fact, it is often not set. history.previous and document.referrer do not seem to be set, either.

Could someone please enlighten me on this?

+1  A: 

I didn't want to go down this path, but the only viable solution I can find is the internal variable (i.e. hist) that jQTouch keeps the browsing history. So, I made the following changes to jqouth.js (revision 146):

around line 256, just before the private functions section, insert:

function getHistory() { return hist; }

around line 625, just before submitForm: submitForm, insert:

getHistory: getHistory,

Then I can look at the browsing history with something like:

var previousPageID = jQT.getHistory()[1].id;

One caveat is, care should be taken not to accidentally maniplulate the history object.

William