javascript - jqm data-rel="back" issue -
imagine following scenario:
i have jquery-mobile formular, it´s results linking resultpage.
on resultpage have button:
<a href="#" data-rel="back" data-role="button"></a>
this works fine update content , keep submitted form data,
but if user came search-engine or similiar extern link, button links searchengine/externlink .
so how differentiate between came form or anywhere else in jqm-way ?
i have "start-search-page" love link if user didn´t came search , don´t want miss ajax-link search resultpage, use same button , idealy don´t have set cookie.
is there hint or smarter attempt check server url document.referrer ? in advance
you can check current page url using below code:
var prevurl = $.mobile.activepage.data('url');
in case u want perform different actions based on previous url. on save url in global javascript variable , on click of button check previous url , functionality. eg
before navigating page:
var prevurl = $.mobile.activepage.data('url');
on click of button:
if (prevurl=="myurl") { //do $.mobile.changepage('#search') } else { $.mobile.changepage('#nothing') }
Comments
Post a Comment