I know there are various threads that ask for nearly the same but none of them seems to really satisfy my needs....
On my site, I implemeneted a search form. A simple form with an input field, called searchQuery
and a submit button. The form is sent with POST method.
I'm using Laravel btw.. The search result are then loaded into a view from the controller. Those are shown in a table. Now comes the interesting part: The found elements are clickable and you get on a page with more details about that element. Then the problem comes: When I now click the browsers back button or my back button on the mouse, I get a window asking to send the form information again and I have to confirm that.
This is not what I want, I want to just get back to the search results I had before....
Now I read a lot, but am still not knowing, how to do that.
I read before onbeforeunload
where you can display a message, but thats not useful for me (I want to get back to the search results)...
So there are some alternatives that would be possible (if technically possible):
- just prevent the dialog asking to submit the information again and just submit it again without asking for
- Somehow go back in the history to the page before (cached maybe or something similiar, search results won't change in that time)
- if I wanted to, I could include the search them in the url like
http://servername/search/searchquery
, then pass this searchquery into the deatil view and have a button to go to that url that then does the search again or something like that. Then you could (maybe) override the browsers back button to "press" that button instead of going back in history...
Is one of these options possible and if yes how? Or is there any other way you can advise?