Join GitHub today
Another new feature in pma 4.0 is the introduction of a microhistory functionality. It is limited compared to native browser history and at the time of writing can hold up to 6 pages (although with some optimisations this number could be doubled).
The core of this feature is the AJAX.cache object that can be found, in 'js/ajax.js'. This object is responsible for caching the content of pages and restore it whenever requested to do so. To keep track of the user's position in the cache, the hash part of the url is changed after each page load and an index is embedded into it, which then points to an entry in the cache.
The url of a page may therefore look like this:
The different parts of the url are:
This is the url that we have requested when opening pma for the first time
This part indicates that the hash part has been set by the AJAX.cache object rather than by clicking on a url that points to a part of the page
The index of the page in the cache
A pointer to the active page, this is used for direct bookmarking of pages, as well as to provide the user with the ability to hit the refresh button in the browser and still land on the same page (rather than index.php which in this case is then main part of the url).
Adding history metadata to links
In order to figure out when one page ends and another starts, the microhistory will track the self_link url which is received with every ajax response. Whenever two self_links are the same, both pages are treated as the same. Sometimes this may not be correct. For example:
would be treated as the same page. And clicking back from the information about the MyISAM engine, you would not return to the list of all storage engines.
Another example is when sql.php is called from another page with the "back" parameter set to go back to the page it came from. Here we want to treat both pages as if they were the same page.
To overcome this issue, it is possible to add metadata to links to indicate whether the links will lead to a new page or to a new version of the same page.
<!-- Forces the microhistory to record the response as a new page -->
<a rel="newpage" href="http://www.example.com/pma/server_engines.php?engine=MyISAM"></a>
<!-- Forces the microhistory to just update its record for the current page -->