cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to embed Mashup in HTML iframe

Velkumar
18-Opal

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 7

Hello @Velkumar,

 

On what URL do you host this HTML?

 

/ Constantine

Hi @Constantine 

 

I tried on same server where thingworx is deployed.

 

/VR

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

BABA-SHYAM
14-Alexandrite
(To:Velkumar)

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>

Hi @BABA-SHYAM 

 

I tried code, still facing same issue.

 

Velkumar_0-1591878784886.png

 

/VR

BABA-SHYAM
14-Alexandrite
(To:Velkumar)

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.

slangley
23-Emerald II
(To:Velkumar)

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

Announcements


Top Tags