Skip to main content
19-Tanzanite
June 10, 2020
Question

How to embed Mashup in HTML iframe

  • June 10, 2020
  • 7 replies
  • 3287 views

Hi all,

 

I'm trying to embed Mashup in HTML iframe, but it throwing error while loading. I went through this PTC article still it throwing error - CS318142  

 

PFA the Web.xml file configuration

 

HTML Code

 

 

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

<div class="container"> 
 <iframe class="responsive-iframe" src="http://inchetwxdev2/Thingworx/Mashups/TestMashup?appKey=ec1b7ca4-611a-4f1c-97c3-efcdad3fba00&x-thingworx-session=true"></iframe>
</div>

</body>
</html>

 

 

 

Could anyone help me to solve this issue.

Thanks in advance

 

/VR

7 replies

18-Opal
June 11, 2020

Hello @Velkumar,

 

On what URL do you host this HTML?

 

/ Constantine

Velkumar19-TanzaniteAuthor
19-Tanzanite
June 11, 2020

Hi @Constantine 

 

I tried on same server where thingworx is deployed.

 

/VR

18-Opal
June 11, 2020

@Velkumar, do you see any errors in DevTools, Application or Catalina logs?

15-Moonstone
June 11, 2020

Hello,

 

Try below code.

 

Regards

Shyam

 

============================================

 

<table>
<tr>
<td>
<input type="text" id="inputText" placeholder="Type anything to search..."/><br />
<input type="button" name="radiobutton" value="Search" onClick="changeDivContent()">
</td>
<td>
<div id="div1" style="width:1000px;height:500px;border:1px solid #ddd;"></div>

</td>
</tr>
</table>

<script>
function changeDivContent() {
var input = document.getElementById('inputText').value;
var url = "http://localhost/Thingworx/Runtime/index.html#mashup=MashupName&appKey=2c175b20-43ds-40f0-bb7c-1234323&x-thingworx-session=true&inputProductIds=xyz%3Babc";
var div = document.getElementById('div1');
div.innerHTML = '<iframe style="width:100%;height:100%;" Content-Security-Policy: frame-ancestors "self" frameborder="0" src="' + url + '" />';
var iframe = document.getElementById('iframe');
var htmlStr = url;
iframe.src=htmlStr;
};
function previewUrl(url, target) {

}
</script>

Velkumar19-TanzaniteAuthor
19-Tanzanite
June 11, 2020

Hi @BABA-SHYAM 

 

I tried code, still facing same issue.

 

Velkumar_0-1591878784886.png

 

/VR

15-Moonstone
June 16, 2020

It is something to do with your browser and network. I too faced this issue. It was not working on my system but luckly worked on client's machine.

Support
June 24, 2020

Hi @Velkumar.

 

If one of the previous responses allowed you to resolve your problem, please mark the appropriate one as the Accepted Solution for the benefit of others with the same issue.

 

Thank you for your participation in our community!

 

Regards.

 

--Sharon