Forum Discussion
Integrate tile into an app sample javascript error.
I don't experience that error. My token is a long string starts with "eyJ0eX....". Here is a static HTML which works perfect in my test, just replace the embed url and token with the ones in your case.
<html lang="en">
<head>
<script type="text/javascript">
window.onload = function () {
updateEmbedTile();
};
var width = 500;
var height = 500;
// update embed tile
function updateEmbedTile() {
// replace your embed url here
var embedTileUrl = "https://app.powerbi.com/embed?dashboardId=f1f5155b-c6e2-4147-991b-28d914927d05&tileId=2dcd2a32-725e-4454-9753-b3e01e41a4a1";
if ("" === embedTileUrl)
return;
// to load a tile do the following:
// 1: set the url, include size.
// 2: add a onload handler to submit the auth token
iframe = document.getElementById('iFrameEmbedTile');
iframe.src=embedTileUrl + "&width=" + width + "&height=" + height;
iframe.onload = postActionLoadTile;
}
// post the auth token to the iFrame.
function postActionLoadTile() {
// replace your token here
accessToken = "eyJ0eXAiOiJKV....kGoJT_tGqBbsXCv60YIXJZTdheFAiwFw";
// return if no a
if ("" === accessToken)
return;
var h = height;
var w = width;
// construct the push message structure
var m = { action: "loadTile", accessToken: accessToken, height: h, width: w};
message = JSON.stringify(m);
// push the message.
iframe = document.getElementById('iFrameEmbedTile');
iframe.contentWindow.postMessage(message, "*");;
}
</script>
</head>
<body>
<iframe ID="iFrameEmbedTile" src="" height="500px" width="500px" frameborder="0" seamless></iframe>
</body>
</html>
- ajhops9 years agoFrequent Visitor
Thank you for your reply! I still get the same error. My access token also starts with "eyJ0eXAiOiJ" and is very long. There are no new lines in the string and no whitespace. Can you do me one quick favor and open your browser developer console and execute:
atob("YOUR_ACCESS_TOKEN")and tell me if you get an error.
- Eric_Zhang9 years agoMicrosoft Employee
I've got the same error, however I can still embed with that token.
Embedding is working fine with the HTML in my previous reply. All responses 200(ok).
Not sure if it is the issue of the cluster node, will you try to replace the app.powerbi.com in the embed url with below IP, it is the actual remote server in my test, captured from the chrome dev tool.
https://13.78.91.196/embed?dashboardId=f1f5155bxxxxx914927d05&tileId=2dcd2a32-725e-4454-9753-b3
- ajhops9 years agoFrequent Visitor
When I try that IP address I get insecure response:
I also get all 200s but the tile never appears (only the spinning dots) and the JS error every time. The remote server I am hitting is 137.116.81.69:443.