Skip to main content
Jun 10, 2020 9:59 AM UTC
Question

How to embed Mashup in HTML iframe

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

Jun 11, 2020 9:04 AM UTC

Hello @Velkumar,

 

On what URL do you host this HTML?

 

/ Constantine

VelkumarAuthor
Jun 11, 2020 12:28 PM UTC

Hi @Constantine 

 

I tried on same server where thingworx is deployed.

 

/VR

Jun 11, 2020 2:13 PM UTC

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

Jun 11, 2020 11:30 AM UTC

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>

VelkumarAuthor
Jun 11, 2020 12:30 PM UTC

Hi @BABA-SHYAM 

 

I tried code, still facing same issue.

 

Velkumar_0-1591878784886.png

 

/VR

Jun 16, 2020 12:00 PM UTC

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.

Jun 24, 2020 7:50 PM UTC

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