firefoxextjssencha-cmdextjs7-classic

XML Parsing Error: not well-formed for bootstrap.js file- Firefox


On Loading the Ext JS application in Firefox I observe XML error where bootstrap file is loaded as XML file instead of JSON.

As per my understanding content-type has to be defined in file but since bootstrap file is first to load where else to define it?

enter image description here

I tried to add mimeType in bootstrap.js file but that file is not added in GIT


Solution

  • Due to the absence of a content type in the server's response, Firefox assumes that the response may be in XML format, given that it is an XMLHttpRequest, and therefore attempts to parse it accordingly.

    Add this script in index.html

    <script> 
        if (navigator.userAgent.includes("Firefox")) {
            (function (open) { 
                XMLHttpRequest.prototype.open = function (method, url, async, user, password) { 
                    if (url.includes("bootstrap.json")) { 
                        this.overrideMimeType("application/json"); 
                    } 
                    // reapply original open method 
                    open.apply(this, arguments); 
                }; 
            })(XMLHttpRequest.prototype.open); 
        } 
    </script>