仅使用HTML从URL抓取参数[用于形式嵌入] [英] 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/到/AAAAAA?cl = 123121
是否可以仅使用HTML?因为我正在使用Wordpress,除了构建器和编辑HTML之外,我对它的功能一无所知.
谢谢
可以使用 Typeform嵌入API
您可以看到我在Glitch上制作的工作示例/p>
您可以在此处进行编辑.
复制步骤:
- 在您的HTML中包括Typeform Embed SDK
-
从URL提取参数
let params = new URLSearchParams(location.search);
-
重建您的表单网址
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, } );
希望它会有所帮助:)
A quick question.
<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>
If you can see the cl=xxxxx, I need the xxxxx to be changed based on the parameters entered in the website.
from example:
www.mywebsite.com/formpage?cl=123121
The iframe will run this website: https://f03.typeform.com/to/AAAAAA?cl=123121
Is it possible using only HTML? because I'm working on Wordpress and don't know much what I can do in it other than builders and editing an HTML.
Thanks
This is possible using Typeform Embed API
You can see a working example I made on Glitch
You can edit here.
Steps to reproduce:
- Include Typeform Embed SDK in your HTML
Extract parameters from URL
let params = new URLSearchParams(location.search);
Reconstruct your form URL
var url = "https://YOUR_SUBDOMAIN.typeform.com/to/YOUR_TYPEFORM_ID"; url += "?utm_source=" + params.get('utm_source');
Display form in a target
div
const embedElement = document.querySelector('.target-dom-node'); window.typeformEmbed.makeWidget( embedElement, url, { hideHeaders: true, hideFooter: true, } );
Hope it helps :)
这篇关于仅使用HTML从URL抓取参数[用于形式嵌入]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!