Search code examples
facebookfacebook-graph-apifbjs

FB API: Resource interpreted as Script but transferred with MIME type text/html


I'm using FBJS to post photo

FB.api('me/photos', 'post', {
      message: 'some message',
      url: 'some url'
     }, function(response){
            if (!response || response.error) {
                /*some error alert*/
            else {
                /*some success*/
            }
     }
 });

Almost, it works fine, but OCCASIONALLY, it shows error alert. I see on Console, it says: Resource interpreted as Script but transferred with MIME type text/html

How to deal with it? I've tried some solutions (such as Content-Type, script type...) but it still does not works in SOME times :(

Please help me.


Solution

  • Have you tried

    headers: [ { "name":"Content-Type", "value":"text/javascript; charset=UTF-8"} ]

    If it is only occasional, maybe you're hitting an API call limit and it's returning an error? Check that the data is correct, even if it is getting an error. Use fiddler to get more clear diagnostic results.