Skip to main content

Hi,

 

Im trying to flush out personal email addresses being used on a page that I built on the smart creator. The code i use for the normal builder is not working.

 

 

Also interested...


Hey Suzy. This should help for smart builder pages—let me know if not!

 

<script>
(function () {
  const originalXHR = window.XMLHttpRequest.prototype.open;
  window.XMLHttpRequest.prototype.open = function (method, url, async, user, password) {
    console.log("Intercepted XHR request:", method, url);

    // Check if the request is targeting the Unbounce endpoint
    if (url.includes("lp-form-submit-method=ajax")) {
      const emailField = document.getElementById("emailField");
      const emailValue = emailField?.value || "";

      const regex = /\@(?!(me|mac|icloud|gmail|googlemail|hotmail|live|msn|outlook|yahoo|aol)\.)/;
      if (!regex.test(emailValue.toLowerCase())) {
        alert("Please enter your work email address.");
        throw new Error("Validation failed. AJAX request blocked.");
      }

      console.log("Validation passed. Proceeding with XHR request.");
    }

    return originalXHR.apply(this, arguments);
  };
})();
</script>
 


Reply