Support Article

Unable to launch external application in embedded iframe

SA-38505

Summary



User has configured an iframe in a non-auto generated section to display the external charts. However it is not displaying the charts as expected.

Error Messages



Not applicable


Steps to Reproduce

Configure non-auto generated section to display the externals charts by using below HTML code:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type='application/javascript'>
var load = false;
function loadGraph() {
debugger;
if (!load) {
$( "#post_form" ).submit();
console.log("in load graph");
load = true;
}
}
</script>
</head>
<body >
<form action='https://chart.googleapis.com/chart' method='POST' id='post_form' target="output_frame">
<input type='hidden' name='cht' value='lc'/>
<input type='hidden' name='chtt' value='This is | my chart'/>
<input type='hidden' name='chs' value='300x200'/>
<input type='hidden' name='chxt' value='x'/>
<input type='hidden' name='chd' value='t:40,20,50,20,100'/>

</form>
<iframeonload="loadGraph()" name="output_frame" src="" id="output_frame" width="600" height="200">
</iframe>
</body>
</html>

Root Cause



A software use or operation error: User configuration in HTML code, the markup included in the Section is not proper as it suddenly introduces new HTML document inside Pega generated div tag.

Resolution



Rewrite the Section markup with and the JS function to dynamically generate the form element to be submitted, below is the updated markup:

<script type='text/javascript'>
var loaded = false;
function loadGraph() {

if(!loaded) {
varformParent = document.createElement("div");
formParent.innerHTML = "<form action='https://chart.googleapis.com/chart' method='POST' id='post_form' target='output_frame'> <input type='hidden' name='cht' value='lc'/> <input type='hidden' name='chtt' value='This is | my chart'/> <input type='hidden' name='chs' value='300x200'/> <input type='hidden' name='chxt' value='x'/> <input type='hidden' name='chd' value='t:40,20,50,20,100'/> </form>";
document.body.appendChild(formParent);
jQuery("#post_form").submit();

loaded = true;
}

}
</script>
<iframeonload="loadGraph()" name="output_frame" src="" id="output_frame" width="600" height="200">
</iframe>

Published May 25, 2017 - Updated July 3, 2017

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.