Browser back button fix

When you use link to other page section like: https://your.webflow.page#sectionid, you need to perform two clicks on the browser back button to get back to previous page.

This script fix behavior to normal:

window.onpopstate = function(event) {
  if(event.state == null) {
  	history.go(-1);
  }
}

Best location for it is in header of your site.

2 Likes

This is intended, you shouldn’t override the default for accessibility and consistency.

Yeah, i agree, that this is not best idea, but it is definetly least invasive method to remove double click back button feature with page section link. And i searched wf forum for different solution and couldnt find one.