Why javascript: history.go (-1); not working on mobile devices?

First, some background:

I have an application that presents the user with a search page (html form). After the criteria are filled and the "Search" button is clicked, the results will appear below the criteria section. In the list of results, you can view the details of an individual result by clicking on the link that takes you to a new page. Inside the detail page, I have included the link "Back to results":

<a href="#" onclick="history.go(-1);return false">Back to Results</a>

This works fine in IE8 / 9, Safari, Firefox, and Chrome on the desktop. However, it does not work on my Android phone, my Android emulator or iPhone 3G. I should note that when I use the link on the desktop, I immediately return to what seems to be a cached copy of my search page with the results, and I am placed in the same scroll position in the results. On mobile devices, it looks like the page is reloading 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 detailed information as needed.

Thank you and welcome CN

+3
source share
3 answers

Using:

    <a href="javascript:history.go(-1)">Back to Results</a>

.. "onclick", "href" -

+2

Android javascript -:

webView.getSettings().setJavaScriptEnabled(true);
+1

What method do you use to submit filters to your search page? POST or GET?

If you use POST, you will need to resubmit your filters when they return, otherwise your page will not have anything to filter.

Try switching to GET and see if this works.

I think the important difference is that it works (i.e. sends you a page), but your mobile device does not rearrange your form fields?

0
source

Source: https://habr.com/ru/post/1791290/


All Articles