简体   繁体   中英

Tumblr js output MIME type error

I have been reading up on all the posts I could find about this particular problem, but nothing has explicitly solved my problem. So, I thought I would post about my specific issue.

I have been running a tumblr.com/js feed into my website for the past few months and now it has suddenly broken.

I am getting the (seemingly common) error in Chrome:

Refused to execute script from 'http://peerlesstree.tumblr.com/js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Just a few months ago it was successfully importing tumblr content into an div with the simple html tag:

<div class="tumblrposts">

     <script type="text/javascript" src="http://peerlesstree.tumblr.com/js"></script>

</div>

I have no idea why this has suddenly stopped working and can't seem to find the specific fix for this issue. I have seen posts referring people to mime-type settings but I have not yet been able to implement one to make this work.

I am not trying to duplicate these other chrome mime type error questions, I just can't make the connection between my specific tumblr/js problem and the other post answers I have read.

Thanks!

This expands on the basic answer I found here : mime-type-in-chrome

the php file controls the Content-type and then uses readfile() to access the js content.

php:

<?php header("Content-type: text/javascript"); readfile("http://peerlesstree.tumblr.com/js");?>

then the html calls the php file as if it were js.

html:

<script type="text/javascript" src="js.php"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM