Reputation: 1767
In my case links loading into a special div's wrapers which are parents of its links.
I do it through pageload
event.
All is ok when JQuery Mobile does AJAX requests. But if I click on visited link, jquery mobile doesn't send the request, but show me blank page, replace #page1
content from cache in other words.
I need these requests.
UPD
Events pagebeforeload
, pageload
dont appear in cache case. =\
Upvotes: 4
Views: 15378
Reputation: 1767
Bite my code please
$(document).on('pagebeforeload', function(event, data) {
var url = data.url;
if (url.toLowerCase().indexOf("office") >= 0) {
event.preventDefault();
$.get(data.absUrl, {}, function(res){
_this = $(res);
if (_this.attr('data-id')>0) {
var card_id = _this.attr('data-id');
$('#detail-'+card_id).empty().append(_this).trigger('create');
}
});
data.deferred.reject( data.absUrl, data.options );
}
});
Upvotes: -1
Reputation: 14025
You can specify to not cache the page like this :
<div data-role="page" id="page-detail" data-dom-cache="false">
....
</div>
Update
In fact it is data-dom-cache=false
, available for page, link and dialog
Doc http://jquerymobile.com/demos/1.2.0/docs/api/data-attributes.html
If you want avoid data prefecting for all pages, have a look here : How does one disable Caching in jQuery Mobile UI
Upvotes: 6