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:
我有一个向用户显示搜索页面(html表单)的应用程序。一旦填写了条件并单击了Search按钮,结果就会出现在criteria部分之下。在结果列表中,您可以通过单击将您带到新页面的链接来查看单个结果的细节。在细节页面中,我包含了一个Back to Results链接,如下所示:
<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.
这在IE8/9、Safari、Firefox和桌面浏览器Chrome上都很好用。但是,它不能在我的Android手机、Android模拟器或iPhone 3G上运行。我应该注意到,当我在桌面上使用链接时,我立即返回到我的搜索页面的缓存副本,结果显示,我在结果中处于相同的滚动位置。在移动设备上,似乎页面从服务器重新加载,我的搜索条件消失了,没有结果。
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
谢谢你,CN。
3 个解决方案
#1
2
Use:
使用:
<a href="javascript:history.go(-1)">Back to Results</a>
ie not in "onclick
" but in "href
" - that's work
ie不在onclick而是在href -那就是工作
#2
1
For Android, you need to enable javascript in the webview :
对于Android,需要在webview中启用javascript:
webView.getSettings().setJavaScriptEnabled(true);
#3
0
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.
试着切换到GET,看看是否有效。
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?
我认为重要的区别在于,它正在工作(即发送给您一个页面),但您的移动设备没有重新发布您的表单字段?
#1
2
Use:
使用:
<a href="javascript:history.go(-1)">Back to Results</a>
ie not in "onclick
" but in "href
" - that's work
ie不在onclick而是在href -那就是工作
#2
1
For Android, you need to enable javascript in the webview :
对于Android,需要在webview中启用javascript:
webView.getSettings().setJavaScriptEnabled(true);
#3
0
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.
试着切换到GET,看看是否有效。
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?
我认为重要的区别在于,它正在工作(即发送给您一个页面),但您的移动设备没有重新发布您的表单字段?