Hi, I am having an interesting issue that I understand is expected behavior for cross-page anchor ID links. Webflow support has filled me in and explained that when you click on a link that takes you to an anchor ID on another page, what is really happening in the browser is that it goes to the correct page then their javascript looks up the hashtag ID and auto-scrolls down to that section. Pressing the back button the first time, goes back one step (to the top of the page). The second goes back to the previous page.
What I would like to do is override this behavior with some custom code. The end result of which would be when you reach an anchor ID from another page, you can click the back button in your browser once to return to the page that you came from instead of needing to click twice.
To recreate what I am describing:
- On the following page, scroll to the “Ways to Give in the Future” section: http://five-valleys-land-trust-dev.webflow.io/donations
- Click on one of the blue “Learn More” buttons. These buttons link to #anchor ID links on another page of the site using a relative path. e.g. /planned-giving#Tax-Credit
- The link works as expected but, if you click the back button in your browser, it takes you to the top of the current page instead of taking you back to the Donation page. You need to click the back button twice to return to the page you came from.
I’m wondering if there is some kind of solution involving javascript and access to the browser’s history but I’m not sure how to go about that or how to account for back button presses that occur when a visitor has not arrived on the page via an anchor ID link.
Thanks for any insight you can provide!
Here is my public share link: https://preview.webflow.com/preview/five-valleys-land-trust-dev?preview=ccfe059f1c348094ac45b97894fdf1a8