jQuery UI Widgets › Forums › Editors › FileUpload › Resource interpreted as Document but transferred with MIME type …
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
This topic contains 6 replies, has 4 voices, and was last updated by Hristo 3 years, 10 months ago.
-
Author
-
December 14, 2015 at 10:34 am Resource interpreted as Document but transferred with MIME type … #79262
Hi,
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 (
event.args.response
fromuploadEnd
) is a string containing the JSON embedded in apre
tag. 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
3.9.0
.Thanks,
RobertDecember 14, 2015 at 10:59 am Resource interpreted as Document but transferred with MIME type … #79267Hi Robert,
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?.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/December 14, 2015 at 1:35 pm Resource interpreted as Document but transferred with MIME type … #79278Dear Dimitar,
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
text/html
.args.event.response
is 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
$.post
instead ofajaxSubmit
. However I suspect this call is buried somewhere injqxfileupload.js
orjquery-1.11.1.min.js
.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:3Thank you very much, jqxWidgets is fantastic,
RobertEdit: hid the URL
December 1, 2020 at 6:45 pm Resource interpreted as Document but transferred with MIME type … #113719Hi,
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.
Thanks
Hafiz Muhamad UsamaDecember 2, 2020 at 10:22 am Resource interpreted as Document but transferred with MIME type … #113723Hello 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:
https://www.jqwidgets.com/community/topic/resource-interpreted-as-document-but-transferred-with-mime-type/#post-79267
I think this tutorial will be helpful, too.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.comDecember 4, 2020 at 5:57 am Resource interpreted as Document but transferred with MIME type … #113738Hy, 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.
Thanks
Hafiz Muhammad usama
usama.fastnu@gmail.comDecember 4, 2020 at 12:19 pm Resource interpreted as Document but transferred with MIME type … #113743Hello Hafiz,
Thank you for your contribution.
Definitely, it will be helpful for someone else.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.