Having read a load of posts related to what I want to do, I'm pretty certain it is impossible but I'll ask the question anyway in the hopes that someone might have solved this problem before or can point me in the right direction to a solution.
I have a complex PHP/MySQL web application where I wish to keep browser tabs/windows independent. e.g. the user can run a search on the database in one tab and another search in another tab and various parameters set up and stored as the searches are conducted are linked only to the relevant browser tab. Reloading a tab or moving further through the search (a paging system limits the number of results stored) does not interfere with the other search tab and uses the parameters identified with the current tab only.
My idea is to store search and other parameters to do with the browser tab in a database table keyed by some unique identifier tied to the tab.
I cannot use PHP sessions as these are common across the tabs. PHP, being server-side, does not know from which tab/window a request comes from. Cookies, like sessions, are common across tabs.
The solution for keeping track of different tabs/windows appears to be javascript's sessionStorage which at first sight seems ideal – I can set a js session vaiable that is unique to the browser tab and echo it back to the PHP script and, in each tab, I can set and keep an independent value. Yet, I need to assign that js session value to a PHP variable and this needs to be available before the search part of the PHP script runs. There is no interaction on the part of the user (i.e. no form submit etc.) other than loading a URL.
I've come across solutions suggesting AJAX/JQuery but these all require a form and some type of user interaction after the PHP script has run and most examples I've seen write to the innerHtml of a div. None of this accomplishes what I want.
Lately, I've been toying with the idea of parsing each page of my application through a gateway URL that simply loads a javascript script that creates the js session (if not already created) and then redirects to the actual PHP script with the unique identifier as part of the querystring. But this seems to involve unnecessary overhead.
Any suggestions or even solutions would be gratefully accepted.
–––>
In response to ADyson (as the comment box is too short):
The application is here: https://testdrive.wikindx.com/
It's for academics/research students to manage references. They all work in different ways including some liking to open multiple tabs to do different searches and there's the problem. Each search, for example, produces results that are displayed back on the web page but also other information such as the search parameters (for reference). The paging system (i.e. displaying e.g. 10 results/page) is designed so that going to the next page utilizes a quicker and more efficient SQL call – all the heavy work being done on the initial search. Search parameters and summary results/totals are done on this first call and these must be saved somewhere as well as the core SQL subqueries. Basically, there are data that are common across different pages of the search that must be stored somewhere and that are unique to that search in that browser tab.