“not well-formed” error in Firefox when loading JSON file with XMLHttpRequest

前端 未结 8 2267
青春惊慌失措
青春惊慌失措 2020-11-28 09:57

I\'m getting a \"not well-formed\" error in the error console of Firefox 3.0.7 when the JavaScript on my page loads a text file containing an object in JavaScript Object Not

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 10:00

    Browser --- request expects a given content-type ---> Server
            <-- response contains content-type ----------
    

    Firefox looks at the HTTP Content-Type header. If the server HTTP response header does not match the expectations of your browser code it will complain with this message.

    IMHO this error message could have been a lot better, like "Expecting response Content-Type header ... but found ...".

提交回复
热议问题