You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在JavaScript中向URL传递未编码的邮箱字符串?——HubSpot表单跳转URL编码问题咨询

Fixing Unencoded Email in HubSpot Form Redirect URL

Hey there! I see exactly what's going on here—your email address is getting URL-encoded (with @ turning into %40) when redirecting to your Typeform, and you need the raw, unmodified email for that hidden field. Let’s fix this quickly.

The Root Cause

Looking at your code, you’re using encodeURIComponent() on every field, including the email. This function converts special characters like @ into URL-safe equivalents, which is useful for most fields, but Typeform needs the original email format here.

The Solution

Just remove the encodeURIComponent() wrapper from the email variable in your redirect line. Keep encoding for all other fields—this prevents issues with spaces, accents, or special characters that could break the URL structure.

Here’s the modified redirect code snippet:

window.location = "[URL TO REDIRECT TO HERE]?firstName=" + encodeURIComponent( firstname ) +"&lastName=" + encodeURIComponent( lastname ) +"&email=" + email + "&phone=" + encodeURIComponent( phone ) + "&language=" + encodeURIComponent( lang );

Quick Checks After Making the Change

  • Test the form submission to confirm the email appears with the @ symbol (not %40) in your Typeform’s hidden field.
  • Double-check that other fields (like names with spaces or accented characters) still pass through correctly—their encoding is still intact to handle those edge cases.

内容的提问来源于stack exchange,提问作者Ry_iu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 23:09:07