Created
April 17, 2015 05:06
-
-
Save lippytak/f61589d4a21a135a026d to your computer and use it in GitHub Desktop.
typeform embed with get parameter passing
This file contains 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
<!--Upload this file to your server--> | |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<!--Add the title of your typeform below--> | |
<title>CalFresh</title> | |
<!--CSS styles that ensure your typeform takes up all the available screen space (DO NOT EDIT!)--> | |
<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> | |
<script> | |
// Get source from URI | |
var source = window.location.toString().split('?')[1] | |
if (/mobile|tablet/i.test(navigator.userAgent.toLowerCase())) { | |
// Redirect to source: | |
window.location.href = "https://getcalfresh.typeform.com/to/SOeXfq?" + source + "&embed=full"; | |
} else { | |
// Inject iframe into body | |
//body = document.getElementsByTagName("body"); | |
var frame = "<iframe id=\"typeform-full\" width=\"100%\" height=\"100%\" frameborder=\"0\" src=\"https://getcalfresh.typeform.com/to/SOeXfq?" + source + "&embed=full\"></iframe>"; | |
document.body.innerHTML = frame; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment