Skip Navigation

[Resolved] remember search items when using the back button

This thread is resolved. Here is a description of the problem and solution.

Problem:
When clicking on one of the results of a custom search View and then user the browser back button to return to the search page, the previous search settings are lost.

Solution:
Go to the Browser history management section of the Toolset > Settings > Front-end Content page and check it is enabled for ajax custom search.

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by massimoS527 6 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#901614

when I click on a result and then return to the search page the filters are reset. How can I keep them?

Thanks

#901680

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Massimo

If you use the browser's back button it will remember the search terms when returning to the page.

How are your users navigating back to the search page?

You could add a Back button into your template for displaying single posts that either generated the URL for the link to include search parameters dynamically, but much simpler would be to simply add a button and use the history.back() JavaScript method to return to the previous page.

Something like this:

// add a button like so:
<button class="back-button">Back</button>

// add custom JS to the template where the button is added
document.querySelector(".back-button").on( "click", function(){
    history.back();
});
#901698

with the back button of the browser, you do NOT remember the search terms

try again:
hidden link

#901703

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screen Shot 2018-05-21 at 16.50.46.png

It does remember the search terms on my simple test site, and would be expected to do so by default.

Check your settings at Toolset > Settings > Front-end content to see if the browser history management options are enabled (see screenshot).

If they are already, please change to the twentyseventeen theme and disable all non-Toolset plugins and then test your page again.

I'm not sure why your site is reloading the page rather than reverting to the page in the browser cache, which is what the back button would normally do.

#901758

great Nigel, were the settings to be enabled.

thank you