Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

2. Next you need to add some JavaScript to the web page you are link to that reads the URL parameter and adds it to the iframe which displays the Leap app.  This can be done with the follow code:

Code Block
languagejsxml
<!-- this sets up the iframe shell -->
<iframe width = "70%" height="600" id="myIframe" src="" frameborder="0"></iframe>  

<!-- script which gets the parameter and sets the iframe src property -->
<script>
window.onload = function(){
	url = document.location.href;
	var paramId = new URL(url).searchParams.get("id");

	var frameElement = document.getElementById("myIframe");
	
<!-- if parameter is there the frame is set to load with it -->
	if (paramId !== null) {
	frameElement.src = 'http://leapsandbox.hclpnp.com/forms/secure/1/app/2cff1ab9-1e7d-4ddf-98bb-60844257c9c2/launch/index.html?form=F_Form1&id='+ paramId;
		}
	
<!--  otherwise it loads without the parameter -->
	else {
	frameElement.src = 'http://leapsandbox.hclpnp.com/forms/secure/1/app/2cff1ab9-1e7d-4ddf-98bb-60844257c9c2/launch/index.html?form=F_Form1';
		}
	}
</script>

...