jQuery mobile force full reload when link clicked -
i have "normal" link in jqm page this:
<a href="http://www.mysite.com/mobile/page.php?attribute=value">
and if click it won't refresh taking account attribute value , loading that's needed dynamically based on attribute value. understand due fact jqm tries ajax call mentioned here:
when use pagechange ajax request made url , loaded content inside div data-role="page". have out of element ignored (js , css).
so, found out in docs should use $.mobile.ajaxenabled=false;
or rel=external
on links or target=_blank
on link.
strange thing though me when set target=_blank
property links happen. so, wondering if had kind of problem , how did solve it? thing is, refrain myself form using target=_blank
opens new tab in browser (as expected, not nice users' pov).
jqm version use 1.2
this question @ top of google search results, figured i'd answer:
use data-ajax attribute , set false force reload upon clicking link:
data-ajax="false"
use like:
<a href="/" data-ajax="false"> <img id="mainlogo" src="logo.svg" width="215" /> </a>
and link force reload page!
links point other domains or have rel="external", data-ajax="false" or target attributes not loaded ajax. instead, these links cause full page refresh no animated transition. both attributes (rel="external" , data-ajax="false") have same effect, different semantic meaning: rel="external" should used when linking site or domain, while data-ajax="false" useful opting page within domain being loaded via ajax. because of security restrictions, framework opts links external domains out of ajax behavior.
parts taken https://stackoverflow.com/a/22951472
Comments
Post a Comment