Last active
August 4, 2020 20:33
-
-
Save ericdodds/43e546f1b9e04cb6465307c7093fc8c7 to your computer and use it in GitHub Desktop.
Pass URL parameters to Pardot form iframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<noscript> | |
<iframe src="PARDOT_FORM_URL" width="100%" height="500" type="text/html" frameborder="0" allowTransparency="true" style="border: 0"></iframe> | |
</noscript> | |
<script type="text/javascript"> | |
var form = 'PARDOT_FORM_URL'; | |
var params = window.location.search; | |
var thisScript = document.scripts[document.scripts.length - 1]; | |
var iframe = document.createElement('iframe'); | |
iframe.setAttribute('src', form + params); | |
iframe.setAttribute('width', '100%'); | |
iframe.setAttribute('height', 500); | |
iframe.setAttribute('type', 'text/html'); | |
iframe.setAttribute('frameborder', 0); | |
iframe.setAttribute('allowTransparency', 'true'); | |
iframe.style.border = '0'; | |
thisScript.parentElement.replaceChild(iframe, thisScript); | |
</script> | |
// Original Salesforce Pardot Knowledge Article here: https://help.salesforce.com/articleView?id=000269753&type=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bless you.