diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js index 04ca8f2d523802bb718e20ae1ad1f42d790e4401..6d51bc0476f1b5c54f0e16975e8cc12301a39f56 100644 --- a/themes/bootstrap3/js/record.js +++ b/themes/bootstrap3/js/record.js @@ -183,6 +183,8 @@ function ajaxLoadTab($newTab, tabid, setHash) { } if (typeof setHash == 'undefined' || setHash) { window.location.hash = tabid; + } else { + removeHashFromLocation(); } }); return false; @@ -264,6 +266,15 @@ function applyRecordTabHash() { } } +function removeHashFromLocation() { + if (window.history.replaceState) { + var href = window.location.href.split('#'); + window.history.replaceState({}, document.title, href[0]); + } else { + window.location.hash = '#'; + } +} + $(window).on('hashchange', applyRecordTabHash); function recordDocReady() { @@ -293,7 +304,11 @@ function recordDocReady() { $(this).tab('show'); if ($top.find('.' + tabid + '-tab').length > 0) { $top.find('.' + tabid + '-tab').addClass('active'); - window.location.hash = tabid; + if ($(this).parent().hasClass('initiallyActive')) { + removeHashFromLocation(); + } else { + window.location.hash = tabid; + } return false; } else { var newTab = getNewRecordTab(tabid).addClass('active');