redirect= parameter. window.location.href and encodeURIComponent(...) to update each link’s redirect= value with the current page URL.You want to use JavaScript to dynamically update a query parameter like ?redirect= so that it reflects the current page's full URL in Webflow.
example.com/login?redirect= and want the value after redirect= to dynamically match the current page's URL, e.g., example.com/pricing.
redirect= Parameter
Example JS logic (description only):
?redirect= or &redirect=.redirect= with window.location.href.
Use this description to implement in your custom code section:
window.location.href.URLSearchParams or .split() methods to manipulate existing links.href attributes of your target links, injecting the current URL after redirect=.
For example:
href so that redirect= is followed by encodeURIComponent(window.location.href).
If you have a login link like:
https://example.com/login?redirect=
You change it dynamically via JavaScript so that it becomes:
https://example.com/login?redirect=https%3A%2F%2Fexample.com%2Fpricing
Assuming the current page is /pricing.
To dynamically insert the current URL into a ?redirect= parameter in Webflow:
window.location.href to get the current page URL.redirect= value using encodeURIComponent(...) to ensure the full URL is safely encoded.