Embed a login pop up without redirecting users to the dashboard Completed

I am currently redirecting users to the dashboard upon login. But elsewhere I need to embed a login pop up without redirecting them to the dashboard and stay on the same page with a logged in functionality. How do I achieve this?



  • Comment author
    Duncan Hamra
    • Edited
    • Official comment

    ūüéČ 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.

  • Comment author
    Julian Galluzzo

    Depending on your use case, you may be able to just duplicate the same page with a pop up pre-opened and then redirect it there

  • Comment author
    Ranjit Sreenivas

    That won't be a good user experience with redirect of the entire page. Can we do it in the background while the pop up is still open using the memberstack API?

  • Comment author
    Julian Galluzzo

    If you prefetch the page the redirect will basically be instant that should work assuming they're both small pages, if they're large then maybe not

  • Comment author
    Chukwudi Onyekwere
    Alternatively, on the page with the login pop-up modal, you can add the script below within the head tags.
    window.$memberstackDom.getCurrentMember().then(({ data: member }) => {
      if (member) {
         window.location.href = "LinkToThePageGoesHere";
      } else {
        // do logged out logic here
    P.S: In the code snippet above, replace the LinkToThePageGoesHere with the actual link to that page.

Please sign in to leave a comment.