Eunos
09-24-2016, 10:50 AM
I've been using the external feed with type Javascript for years to embed a feed onto the front page of my site. However, things have recently changed. For security, Apache is set to include the following header:
Header set X-Content-Type-Options nosniff
This works fine for Safari and Firefox, but Google Chrome now enforces strict mime types. In Chrome, it throws the following error:
Refused to execute script from 'http://forum.miata.net/vb/external.php?type=js&forumids=82' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
What other options do I have to get the feed to work in Chrome? I know I can set the feed to XML or RSS, but I don't know how to implement it in Javascript.
Here's my current code:
<script type="text/javascript" src="http://forum.miata.net/vb/external.php?type=js&forumids=82"></script>
<script language="" type="text/javascript">
<!-- for (i = 0; i < 8; i++)
{
document.writeln("<p>"+threads[i].threaddate+": <b>"+threads[i].title+"</b><br>
<a href=\"http://forum.miata.net/vb/showthread.php?threadid="+threads[i].threadid+"\">Read more...</a></p>");
}
//--> </script>
Here's a test page: http://www.miata.net/test.html
The test page works with Safari and Firefox,but not with Chrome.
Any suggestions on how to get a feed to work with Chrome?
--------------- Added 1474723184 at 1474723184 ---------------
I found a temporary workaround, which is to put a <filesMatch> directive in Apache so the nosniff header doesn't get sent for external.php. Maybe this is fine as a permanent workaround, but I'd still be interested in knowing if there's a cleaner way.
TIA
Header set X-Content-Type-Options nosniff
This works fine for Safari and Firefox, but Google Chrome now enforces strict mime types. In Chrome, it throws the following error:
Refused to execute script from 'http://forum.miata.net/vb/external.php?type=js&forumids=82' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
What other options do I have to get the feed to work in Chrome? I know I can set the feed to XML or RSS, but I don't know how to implement it in Javascript.
Here's my current code:
<script type="text/javascript" src="http://forum.miata.net/vb/external.php?type=js&forumids=82"></script>
<script language="" type="text/javascript">
<!-- for (i = 0; i < 8; i++)
{
document.writeln("<p>"+threads[i].threaddate+": <b>"+threads[i].title+"</b><br>
<a href=\"http://forum.miata.net/vb/showthread.php?threadid="+threads[i].threadid+"\">Read more...</a></p>");
}
//--> </script>
Here's a test page: http://www.miata.net/test.html
The test page works with Safari and Firefox,but not with Chrome.
Any suggestions on how to get a feed to work with Chrome?
--------------- Added 1474723184 at 1474723184 ---------------
I found a temporary workaround, which is to put a <filesMatch> directive in Apache so the nosniff header doesn't get sent for external.php. Maybe this is fine as a permanent workaround, but I'd still be interested in knowing if there's a cleaner way.
TIA