File tree Expand file tree Collapse file tree
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,3 +101,26 @@ function indexFilesLoaded() {
101101 && memberSearchIndex
102102 && tagSearchIndex ;
103103}
104+
105+ // Workaround for scroll position not being included in browser history (8249133)
106+ document . addEventListener ( "DOMContentLoaded" , function ( ) {
107+ var contentDiv = document . querySelector ( "div.flex-content" ) ;
108+ window . onpopstate = function ( e ) {
109+ if ( e . state !== null ) {
110+ contentDiv . scrollTop = e . state ;
111+ }
112+ }
113+ window . onhashchange = function ( e ) {
114+ history . replaceState ( contentDiv . scrollTop , document . title ) ;
115+ }
116+ contentDiv . onscroll = function ( e ) {
117+ var timeoutID ;
118+ if ( ! timeoutID ) {
119+ timeoutID = setTimeout ( function ( ) {
120+ history . replaceState ( contentDiv . scrollTop , document . title ) ;
121+ timeoutID = null ;
122+ } , 100 ) ;
123+ }
124+ }
125+ history . replaceState ( contentDiv . scrollTop , document . title ) ;
126+ } ) ;
You can’t perform that action at this time.
0 commit comments