make #2350 work using replaceState

edit
Hakim El Hattab 2019-03-21 09:13:28 +01:00
parent ae556d0844
commit b8de5e02d2
1 changed files with 11 additions and 6 deletions

View File

@ -4290,19 +4290,24 @@
writeURLTimeout = setTimeout( writeURL, delay );
}
else if( currentSlide ) {
// If we're configured to push to history OR the history
// API is not avaialble.
if( config.history || !window.history ) {
window.location.hash = locationHash();
}
// If we're configured to refelct the current slide in the
// URL without pushing to history.
else if( config.hash ) {
window.history.replaceState(null, null, '#' + locationHash());
window.history.replaceState( null, null, '#' + locationHash() );
}
// If history and hash are both disabled, a hash may still
// be added to the URL by clicking on a href with a hash
// target. Counter this by always removing the hash.
else {
window.location.hash = '';
window.history.replaceState( null, null, window.location.pathname + window.location.search );
}
}
}
/**
* Retrieves the h/v location and fragment of the current,