仅使用 HTML 从 URL 获取参数 [对于 Typeform 嵌入]
Grab Parameters From URL Using HTML Only [For Typeform Embedding]
一个简单的问题。
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <title>Re-Imagining Business Models</title> <style type="text/css"> html{ margin: 0; height: 100%; overflow: hidden; } iframe{ position: absolute; left:0; right:0; bottom:0; top:0; border:0; } </style> </head> <body> <iframe id="typeform-full" width="100%" height="100%" frameborder="0" src="https://f03.typeform.com/to/AAAAAA?cl=xxxxx"></iframe> <script type="text/javascript" src="https://embed.typeform.com/embed.js"></script> </body> </html>
如果能看到cl=xxxxx,我需要根据网站输入的参数修改xxxxx
来自示例:
www.mywebsite.com/formpage?cl=123121
iframe 将 运行 这个网站:https://f03.typeform.com/to/AAAAAA?cl=123121
是否可以仅使用 HTML?因为我在 Wordpress 上工作,除了构建器和编辑 HTML.
之外,我不知道我能在其中做什么
谢谢
这可以使用 Typeform Embed API
你可以看到我在 Glitch
上制作的 working example
您可以编辑 here。
重现步骤:
- 在您的 HTML
中包含 Typeform Embed SDK
从URL
中提取参数
let params = new URLSearchParams(location.search);
重构你的表单URL
var url = "https://YOUR_SUBDOMAIN.typeform.com/to/YOUR_TYPEFORM_ID";
url += "?utm_source=" + params.get('utm_source');
在目标中显示表格div
const embedElement = document.querySelector('.target-dom-node');
window.typeformEmbed.makeWidget(
embedElement,
url,
{
hideHeaders: true,
hideFooter: true,
}
);
希望对您有所帮助:)
一个简单的问题。
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <title>Re-Imagining Business Models</title> <style type="text/css"> html{ margin: 0; height: 100%; overflow: hidden; } iframe{ position: absolute; left:0; right:0; bottom:0; top:0; border:0; } </style> </head> <body> <iframe id="typeform-full" width="100%" height="100%" frameborder="0" src="https://f03.typeform.com/to/AAAAAA?cl=xxxxx"></iframe> <script type="text/javascript" src="https://embed.typeform.com/embed.js"></script> </body> </html>
如果能看到cl=xxxxx,我需要根据网站输入的参数修改xxxxx
来自示例:
www.mywebsite.com/formpage?cl=123121
iframe 将 运行 这个网站:https://f03.typeform.com/to/AAAAAA?cl=123121
是否可以仅使用 HTML?因为我在 Wordpress 上工作,除了构建器和编辑 HTML.
之外,我不知道我能在其中做什么谢谢
这可以使用 Typeform Embed API
你可以看到我在 Glitch
上制作的 working example您可以编辑 here。
重现步骤:
- 在您的 HTML 中包含 Typeform Embed SDK
从URL
中提取参数let params = new URLSearchParams(location.search);
重构你的表单URL
var url = "https://YOUR_SUBDOMAIN.typeform.com/to/YOUR_TYPEFORM_ID"; url += "?utm_source=" + params.get('utm_source');
在目标中显示表格
div
const embedElement = document.querySelector('.target-dom-node'); window.typeformEmbed.makeWidget( embedElement, url, { hideHeaders: true, hideFooter: true, } );
希望对您有所帮助:)