Skip to content

Instantly share code, notes, and snippets.

@lippytak
Created April 17, 2015 05:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lippytak/f61589d4a21a135a026d to your computer and use it in GitHub Desktop.
Save lippytak/f61589d4a21a135a026d to your computer and use it in GitHub Desktop.
typeform embed with get parameter passing
<!--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 + "&amp;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