Skip to content

Commit

Permalink
make hakimel#2350 work using replaceState
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Mar 21, 2019
1 parent ae556d0 commit b8de5e0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.history.replaceState( null, null, window.location.pathname + window.location.search );
}
else {
window.location.hash = '';
}
}



}
/**
* Retrieves the h/v location and fragment of the current,
Expand Down

0 comments on commit b8de5e0

Please sign in to comment.