Patch #13900

Updated by Jean-Baptiste Barth over 8 years ago

Redmine tabs (in Settings or Administration for instance) are all loaded at once when the page is loaded. When changing tab, the URL is not updated, hence it breaks navigation in some minor ways, which I find annoying on a daily basis.. :
* if the user reloads the page he's sent back to the default tab, not the one he was viewing
* previous/next buttons behave counterintuitively : only the default tab remains in the history, and once you leave a tab, you never go back to it without having to re-click on the tab

The simplest solution to that is to use the History API introduced a couple years ago in most browsers, so that URL is updated whenever a click on a new tab occurs. Basically it boils down to this: <pre><code class="javascript">
/* better handling of history in redmine tabs */
$(function() {
$(".tabs a").on("click", function() {
//only trigger history API if supported
if ("replaceState" ((&quot;replaceState&quot; in window.history) window.history)) {
//replace current URL with the "href" attribute of the current link
window.history.replaceState(null, history.replaceState(null, document.title, this.href);

Any opinion on that is welcome. If none I'll add it in the next few days, I think I'll integrate it directly in the @showTab()@ function.