admin管理员组文章数量:1410689
First, some background:
I have an application which presents a search page (html form) to the user. Once criteria have been filled out and the Search button is clicked, results appear beneath the criteria section. In the list of results, you can view the detail of an individual result by clicking a link which takes you to a new page. Within the detail page, I have included a Back to Results link like so:
<a href="#" onclick="history.go(-1);return false">Back to Results</a>
This works great in IE8/9, Safari, Firefox and Chrome on the desktop. However, it does not work on my Android phone, my Android emulator or the iPhone 3G. I should note that when I use the link on the desktop I am immediately returned to what seems to be a cached copy of my search page with results, and I'm placed at the same scroll position within the results. On the mobile devices, it appears as though the page reloads from the server, my search criteria disappear, and there are no results.
If anyone has any ideas on where to start looking for a solution, I would really appreciate it! I can also provide more detail as necessary.
Thank you and regards, CN
First, some background:
I have an application which presents a search page (html form) to the user. Once criteria have been filled out and the Search button is clicked, results appear beneath the criteria section. In the list of results, you can view the detail of an individual result by clicking a link which takes you to a new page. Within the detail page, I have included a Back to Results link like so:
<a href="#" onclick="history.go(-1);return false">Back to Results</a>
This works great in IE8/9, Safari, Firefox and Chrome on the desktop. However, it does not work on my Android phone, my Android emulator or the iPhone 3G. I should note that when I use the link on the desktop I am immediately returned to what seems to be a cached copy of my search page with results, and I'm placed at the same scroll position within the results. On the mobile devices, it appears as though the page reloads from the server, my search criteria disappear, and there are no results.
If anyone has any ideas on where to start looking for a solution, I would really appreciate it! I can also provide more detail as necessary.
Thank you and regards, CN
Share edited Apr 29, 2012 at 17:03 Knu 15.2k6 gold badges59 silver badges92 bronze badges asked Feb 10, 2011 at 18:56 CircusNinjaCircusNinja 2671 gold badge6 silver badges13 bronze badges 1- Check for cacheing headers on the mobile setups? Many (most? all?) mobile ISPs have transparent proxies that could be enforcing no-cache headers of some sort, forcing the remote devices to reload the pages and incur higher data charges ($$$kaching$$$) – Marc B Commented Feb 10, 2011 at 19:14
3 Answers
Reset to default 2Use:
<a href="javascript:history.go(-1)">Back to Results</a>
ie not in "onclick
" but in "href
" - that's work
For Android, you need to enable javascript in the webview :
webView.getSettings().setJavaScriptEnabled(true);
What method are you using to pass filters to your search page? POST or GET?
If you're using a POST then you would have to resubmit your filters when they go back, otherwise your page won't have anything to filter on.
Try switching to a GET and see if that works.
I think the important distinction is that it is working (i.e. sending you back a page), but your mobile device isn't reposting your form fields?
本文标签: androidWhy is javascripthistorygo(1) not working on mobile devicesStack Overflow
版权声明:本文标题:android - Why is javascript:history.go(-1); not working on mobile devices? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744808387a2626287.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论