Localization: Redirecting Users to a Thank You Page Based on Language in Webflow

Hi everyone,

I’m currently working on setting up a multilingual website using Webflow’s localization feature, and I’m wondering if there’s a way to redirect users to a “thank you page” based on their selected language.

At the moment, I’ve noticed that the redirection link is only accessible on the primary language version of the site. Does anyone know if there’s a way to implement custom code to achieve this functionality for all language versions?

If you have any insights or solutions to share, please let me know. Your help would be greatly appreciated!

Thank you,

J-P

It’s a bit hacky, but I can think of two approaches, both involving custom code.

PRE-ADJUST URL
Here you’d have code in your form page that-

  • Checks the <html lang= to determine the current locale.
  • Then, if it’s not the default locale, the script adjusts the redirect URL.

POST-REDIRECT
In case option 1 doesn’t work due to webflow.js implementation details, you could do this afterwards
In the form page;

  • Check the <html lang= and save it to sessionStorage

Have the form redirect go to a blank page, which a script. The script;

  • Retrieves the sessionStorage var
  • Determines what URL the user should go to
  • Redirects the user to that URL
1 Like

Hi Micheal!

Your fast response is greatly appreciated! Thank you once again for your support. :slightly_smiling_face:

For anyone in need of the code to make this work, please find it below!

<script>
  document.addEventListener("DOMContentLoaded", function () {
    // use getElementByClass if you want to target the class of the form instead of the ID
    var form = document.getElementById('ID of your form');

    if (form) {
      // Check the current page URL for language identification. In this example there are two possible languages, Dutch (nl) and English (en)
      if (window.location.href.includes("/nl/")) {
        // For Dutch language pages
        form.setAttribute('action', 'url of dutch landing page');
      } else if (window.location.href.includes("/en/")) {
        // For English language pages
        form.setAttribute('action', 'url of english landing page');
      }
    }
  });
</script>

1 Like