🎉 Good news!
You can now use the attribute data-ms-redirect="current-url"
to save the current URL. The next time that visitor goes to sign up or login they will be returned to the page.
Here's the full help center article.
------------------------------------------------------------------------
In this article, I'll show you a neat redirect hack. With a few bits of code, you can override the default Memberstack redirect and keep members on the same page after they log in or sign up.
Adding Site-Wide Code
This snippet saves the user's current page in the browser.
- Log in to your Webflow account and open a project.
- Open the Custom Code editor.
- Go to the Footer Code field and paste in this sitewide </body> code.
<script>
// sets the url of the page you're on for redirecting back to it
localStorage.setItem('locat', location.href);
</script>
Adding Page Code
Next, add the following code to a blank page. This snippet redirects the browser back to the saved page (see above).
- Open the Webflow Designer.
- Create a new page and give it a name (e.g. called Success).
- Scroll down the Settings page to the Custom Code field.
- Paste the following code into the Inside <head> tag field.
- Click Create and then Publish.
<script>
// redirects back to the page you were just on
window.location = localStorage.getItem('locat');
</script>
That's it.
Now you know how to keep users on the same page after they log in or sign up.
Comments
0 comments
Please sign in to leave a comment.