Want to add a back button to your thank you or 404 not found page on Webflow? The old solutions found in forums don't work anymore in modern browsers. Our brix-go-back solution works in all cases - it takes users back to the previous page when they navigated from within your site, and automatically redirects to a fallback page (like your homepage) when they came from external sources like Google.
This solution is completely free, weighs only 742 bytes (<1KB), and can be implemented in less than 1 minute.
Implement it like this in 3 simple steps:
Go to Page Settings → Custom Code → Before </body> tag and paste this code:
<script>
/**
* BRIX Templates Back Button
* Smart back navigation with same-domain detection and fallback support using brix-go-back attribute.
* @version 1.0.1
*/
(function() {
'use strict';
function init() {
document.querySelectorAll('[brix-go-back]').forEach(el => {
el.addEventListener('click', e => {
e.preventDefault();
const fallback = el.getAttribute('brix-go-back') || '/';
const referrer = document.referrer;
(referrer && new URL(referrer).hostname === location.hostname && history.length > 1) ? history.back() : location.href = fallback;
});
});
}
document.readyState === 'loading' ? document.addEventListener('DOMContentLoaded', init) : init();
})();
</script>
Alternatively, you can add this to Project Settings → Custom Code if you need back buttons across multiple pages or site-wide.
Add a Button or Link element to your page and in the Element Settings, add the custom attribute:
Publish your site and test it. The button will automatically:
You can add a back button to your Webflow site by using our free brix-go-back script. Add the lightweight JavaScript code to your project's custom code section, then add a button or link element with the brix-go-back attribute. The script automatically handles same-domain navigation and provides fallback options for external referrers.
To create a back button for your Webflow 404 page, use our brix-go-back solution. Add the script to your project's custom code, then place a button with the brix-go-back attribute on your 404 page. Set the attribute value to your desired fallback page (like / for homepage) to ensure users who arrive from external links have somewhere useful to go.
Add a back button to your Webflow thank you pages by implementing our brix-go-back script in your project's custom code, then adding a button with the brix-go-back attribute to your thank you page. This creates smart navigation that works perfectly for form confirmations where users need to navigate back to continue browsing your site.
Want more custom Webflow solutions like this back button implementation? Our Webflow agency builds efficient, lightweight code for navigation, forms, and user experience enhancements that actually work.
Detect and block IE users on Webflow with our free script. Prevents broken layouts and poor user experience. Works with all IE versions!
Add automatic page data tracking to Webflow forms to capture URLs and titles. Works with static pages and CMS collections.
Add different favicons to specific Webflow pages with this easy tutorial. Works with static pages and Webflow CMS collections.