Always redirect to mobile home page, if "other" page is refreshed

also applies when becoming / stopping root, and maybe other cases?
This commit is contained in:
Lance Edgar 2018-01-29 22:47:30 -06:00
parent 9beb32cea2
commit e821b2a025

View file

@ -11,6 +11,16 @@
${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.mobile.js'))}
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.mobile.js'))}
${self.extra_javascript()}
## since jquery mobile will "utterly cache" the first page which is loaded
## by the client, we must make sure that is always the home page. so if
## user tries to e.g. "refresh" some other page, redirect to home page
% if request.matched_route.name != 'mobile.home':
<script type="text/javascript">
location.href = '${request.route_url('mobile.home')}';
</script>
% endif
% if request.rattail_config.getbool('tailbone', 'mobile.flash.autodismiss', default=True):
<script type="text/javascript">
$(document).on('pageshow', function() {