906f2f040a6fd2277cffe12d1826f1d589484562 braney Wed May 30 14:30:10 2018 -0700 address Safari problem where the ready function isn't called after back button. (#21540) diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 4ed4c59..39a0c34 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -4782,30 +4782,38 @@ $("#tabs").css('font-family', jQuery('body').css('font-family')); $("#tabs").css('font-size', jQuery('body').css('font-size')); $('.submitOnEnter').keydown(trackSearch.searchKeydown); findTracks.normalize(); findTracks.updateMdbHelp(0); } } }; /////////////// //// READY //// /////////////// $(document).ready(function() { + // on Safari the back button doesn't call the ready function. Reload the page if + // the back button was pressed. + $(window).bind("pageshow", function(event) { + if (event.originalEvent.persisted) { + window.location.reload() ; + } + }); + // The page may be reached via browser history (back button) // If so, then this code should detect if the image has been changed via js/ajax // and will reload the image if necessary. // NOTE: this is needed for IE but other browsers can detect the dirty page much earlier if (!imageV2.backSupport) { if (imageV2.isDirtyPage()) { // mark as non dirty to avoid infinite loop in chrome. imageV2.markAsCleanPage(); jQuery('body').css('cursor', 'wait'); window.location = "../cgi-bin/hgTracks?hgsid=" + getHgsid(); return false; } } initVars(); imageV2.loadSuggestBox();