[solution] Javascript snippet to redirect to page prior to sign up


I’ve hacked the JS so that it waits on a page with a ‘loading spinner’ whilst the user’s account is set up, before then redirects the user to the page they were originally on before sign up.

It works, but is sometimes very slow and the user is kept on the holding page for a long time! I guess the depends on the load on Zapier/memberstack/webflow.

<!--Place this on your page after signup/login - must be a hidden page-->

 var Webflow = Webflow || [];
 Webflow.push(function() {
MemberStack.onReady.then(function(member) {
var redirect = sessionStorage.getItem('redirect')
    if (redirect) window.location.replace(redirect)
  } else{
    setTimeout(function() { location.reload(true); }, 3000);

I hope this helps someone.

Also, if anyone has any suggestions to optimise or improve the JS, please feel free to make suggestions.



Thanks, JT! Really appreciate you sharing this :grin: