Tagged: Angular file upload, File Upload, fileupload, jquery file upload, jqxFileUpload, json, pre, Resource interpreted as Document but transferred with MIME type application/json, response, sharepoint, uploadEnd
December 14, 2015 at 10:34 am Resource interpreted as Document but transferred with MIME type … #79262
Using jqxFileUpload, I get:
Resource interpreted as Document but transferred with MIME type application/json: "http://localhost:8080/...".
The URL is indeed a REST point that produces JSON. However I didn’t expect it to be read as HTML by default. Is there a way to tell the widget the response will be in JSON so that we get the response as an object?
At the moment, the response data (
uploadEnd) is a string containing the JSON embedded in a
pretag. I suppose I could somehow extract and parse my data, but it just seems awkward. I’d rather declaratively tell the expected response format, or even write a hook function if necessary.
Btw, I’m using version
RobertDecember 14, 2015 at 10:59 am Resource interpreted as Document but transferred with MIME type … #79267
Please take a look at the following Stack Overflow topics for a possible solution on the matter: “Resource interpreted as Document but transferred with MIME type application/json” in Chrome Developer Tools and Chrome says “Resource interpreted as script but transferred with MIME type text/plain.”, what gives?.
http://www.jqwidgets.com/December 14, 2015 at 1:35 pm Resource interpreted as Document but transferred with MIME type … #79278
Thanks for the quick answer, I should defenitely check SO before posting here, sorry for that. The first link was sort of helpful but rather incomplete I’m afraid.
The good news is that there is a solution that worked for me: to change the server response MIME to
args.event.responseis then a string containing the JSON; I can parse it. However I’m fortunate enough to have control over the server process, that might not be a suitable solution in everey case.
Another proposed solution was to remove
multipart/form-data, but this is not possible when uploading files.
Another one wat to add a query string to the URL, didn’t work for me (I was suspicious about this solution anyway).
Finally, apparently, the definite solution is to use
ajaxSubmit. However I suspect this call is buried somewhere in
Here’s the stack trace I get from Chromium, if it is of any value:
Resource interpreted as Document but transferred with MIME type application/json: “http://localhost:8080/…”.
a.extend._uploadFile @ jqxfileupload.js:7
(anonymous function) @ jqxfileupload.js:7
m.event.dispatch @ jquery-1.11.1.min.js:3
r.handle @ jquery-1.11.1.min.js:3
Thank you very much, jqxWidgets is fantastic,
Edit: hid the URL
December 1, 2020 at 6:45 pm Resource interpreted as Document but transferred with MIME type … #113719
- This reply was modified 7 years, 12 months ago by rbossy.
I am new in JQWidgets, I am trying to integrate it with SharePoint 2019, all the js files are working fine, but the issue is only with css files. below is how I linked one of the css files on the SharePoint page.
<link rel=”stylesheet” href=”/sites/test/SiteAssets/css/jqx.base.css” type=”text/css” />
but getting the below error message,
Resource interpreted as Stylesheet but transferred with MIME type application/octet-stream: “http:/server/sites/test/SiteAssets/css/jqx.base.css”.
Please help me in this regards.
Hafiz Muhamad UsamaDecember 2, 2020 at 10:22 am Resource interpreted as Document but transferred with MIME type … #113723
Hello Hafiz Muhamad Usama,
Could you provide us with more details?
It will be better if you could provide us with one simplified example that demonstrates your case.
Also, I hope you try the suggestion of my colleague:
I think this tutorial will be helpful, too.
https://www.jqwidgets.comDecember 4, 2020 at 5:57 am Resource interpreted as Document but transferred with MIME type … #113738
Hy, Hristo, thanks for your response, I was not available since last two days because of illness. I am feeling good now.
Yes I defiantly checked the above suggestion before posting the above query. But the issue was something else.
Solution is as below:
Basically the Css link <link rel=”stylesheet” href=”/sites/test/SiteAssets/css/jqx.light.css” type=”text/css” /> that JS code appends with DOM was not at the correct place in to the SharePoint page after <link rel=”stylesheet” href=”../SiteAssets/JQ/jqwidgets/styles/jqx.base.css” media=”screen”>.
It must be after the jqx.base.css link as shown below
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1"> <link rel="stylesheet" href="../SiteAssets/JQ/jqwidgets/styles/jqx.base.css" media="screen"> <link rel="stylesheet" href="../SiteAssets/JQ/jqwidgets/styles/jqx.light.css" media="screen"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
Another issue was the grid was not render at all.
Solution is as below:
Basically the SharePoint encloses the overall html code into a dive with class class=”ms-rtestate-field” on the page. with fixed height 37px. we should set the height based on our requirement once document ready.
Hopefully this solution will help someone.
Hafiz Muhammad usama
firstname.lastname@example.orgDecember 4, 2020 at 12:19 pm Resource interpreted as Document but transferred with MIME type … #113743
You must be logged in to reply to this topic.