Product: TIBCO Spotfire®
Error "Refused to execute script from 'https://example.com' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled."
When loading custom visuals in Web Player, it may throw the following error when viewed from Web Player.
"Refused to execute script from 'https://example.com' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled."
The same may be reproduced against the SDK example CustomVisualsExample.CustomDonutChart. This is expected to be fixed in SDK version 7.10
In order to survive the mime type check we need to declare the correct mime type, and have an API method for that on CustomVisualView<T> called ResolveContentType as is documented here:
https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/html/M_Spotfire_Dxp_Application_Extension_CustomVisualView_1_ResolveContentType.htm
With respect to the SDK example CustomVisualsExample.CustomDonutChart, the problem is in the override for GetResourceCore in CustomDonutChartView.cs. Code in the API example follows.
=======================================================================
protected override HttpContent GetResourceCore(string path, NameValueCollection query, CustomDonutChart snapshotNode)
{
if (string.IsNullOrEmpty(path))
{
path = "CustomDonutChart.html";
}
var bytes = GetEmbeddedResource("SpotfireDeveloper.CustomVisualsExample.webroot." + path);
return new HttpContent("text/html", bytes);
}
=======================================================================
It needs to be modified to :
=======================================================================
protected override HttpContent GetResourceCore(string path, NameValueCollection query, CustomDonutChart snapshotNode)
{
if (string.IsNullOrEmpty(path))
{
path = "CustomDonutChart.html";
}
var bytes = GetEmbeddedResource("SpotfireDeveloper.CustomVisualsExample.webroot." + path);
var mimeType = ResolveContentType("SpotfireDeveloper.CustomVisualsExample.webroot." + path);
return new HttpContent(mimeType, bytes);
}
=======================================================================
https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/html/M_Spotfire_Dxp_Application_Extension_CustomVisualView_1_ResolveContentType.htm
Comments
0 comments
Article is closed for comments.