jasonmayes / Twitter-Post-Fetcher

Fetch your twitter posts without using the new Twitter 1.1 API. Pure JavaScript! By Jason Mayes
http://www.jasonmayes.com/projects/twitterApi
Other
911 stars 236 forks source link

Refused to execute script because its MIME type is not executable #128

Closed caiters closed 7 years ago

caiters commented 7 years ago

Just today I noticed that a page my company built that utilizes this plugin is no longer loading tweets, and noticed this error in the console.

It also is occurring on http://jasonmayes.com/projects/twitterApi/

Refused to execute script from 'https://cdn.syndication.twimg.com/widgets/timelines/345170787868762112?&lan…witterFetcher.callback&suppress_response_codes=true&rnd=0.9149851753191531' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.

nickwelsh1 commented 7 years ago

Same problem here, just occurred today. Twitter must have changed their API again?

nharn85 commented 7 years ago

I have the same issue. Looks like, per their twitter, updates were made.

Hockeyguy1703 commented 7 years ago

Ah, yes I too am in this boat. Happened to me just today

jasonmayes commented 7 years ago

Thanks for reporting looks like the mime type changed as pointed out in this bug report. Although if that is the case then the widget would also stop working which leads me to believe the path has changed for the JSONP request if they are still using JSONP.

ABonner commented 7 years ago

It looks like the callback function name in the request needs to be on the __twttr object to return an application/javascript response. Any other first parameter causes the API to return application/json, at least in my testing. I'll submit a pull request in a few minutes that is a quick fix at least (this would probably prevent using the main Twitter embed and this script on the same page, though).

jasonmayes commented 7 years ago

I concur with your observation @ABonner. I have an idea here as we dont want to overwrite __twttr should the widget be being used on the page at the same time.

ABonner commented 7 years ago

Ah, nice @jasonmayes you found that it only does a check on the string prefix so the object just needs to start with that. I'll close out my pull request.

jasonmayes commented 7 years ago

Ah sorry, just saw your pull request, but yes, you saw my commit. Thanks for your assistance though. I believe if everyone upgrades to v17 it should work now.

ABonner commented 7 years ago

No worries on the PR. Thanks for making this library, our company has used it a few places where it has come in very handy!

Hockeyguy1703 commented 7 years ago

Thank you Jason, your immediate attention to this update was incredible! Sent you a "beer"