Home › Forums › Classic DFFS › Resource blocked due to MIME type
- This topic has 6 replies, 2 voices, and was last updated 5 years, 3 months ago by Alexander Bautz.
-
AuthorPosts
-
-
July 25, 2019 at 15:41 #26265
Hello Alexander,
I’ve tried to upgrade my 4.4.3.47 version to your brand new 4.4.4.0. It appears all my custom js files aren’t loaded anymore. I’m getting the line below for every script I’ve linked.
The resource from “http://mysite/list/custom.js?v=20190725 was blocked due to MIME type (“”) mismatch (X-Content-Type-Options: nosniff)
Looking into this further more I realized it is because of our additional parameter. Without the parameter the custom script is accepted right away.
One more question: Is it possible the order of execution changed for the custom scripts? Before 4.4.4.0 I could access html elements I created in the tab configuration without problems, now the button doesn’t seem to be there yet. Any ideas/suggestions?
Thank you very much as always! Andreas
-
July 25, 2019 at 19:29 #26267
Ah – I didn’t realize that this did not still work. It is due to a change in v4.4.3.50 made in July 17, 2017 to ensure it works properly when SharePoint online started using Require.js to load all files.
I think the only workaround is to append {inject} to the file name – like this:
http://mysite/list/custom.js?v=20190725{inject}
Because this will bypass Require.js – or to remove the additional parameter from the script. I’ll make a change to trim this query string away in the next version to prevent the error.
Alexander
-
July 25, 2019 at 19:46 #26269
Almost forgot your other question – the order of loading thinks was changed in one of the versions between the one you have from 2017 and the latest one to ensure variables from custom js were available when building the tabs / headings / HTML. If your custom scripts tries to address the HTML or headings I think you should look into using {FieldName} or {var:NameOfVariable} as placeholders in the HTML and headings config – look at the help icon when adding a heading or html section.
Alexander
-
August 16, 2019 at 10:46 #26678
Hello Alexander,
updating to a newer version fixed the mime type error nicely.
Regarding the other issue I’m using the html section to create divs and my custom js to add other elements into that div based on rest calls I’ve done in my custom js.
So I need the div to be there before the custom js is executed, because else I can’t add the child elements. I’ve created a workaround by using a timeout so that the custom js is executed later, however I would be up for suggestions on how to do it without another second delay during loading.
Cheers Andreas
-
August 16, 2019 at 16:10 #26687
My suggestion would be to only trigger this function (your REST calls) if the user selects this particular tab. Either set up a call to the function in the Click function name in the tab configuration, or use a rule triggering on Selected tab index to call your function.
Will this work for you?
Alexander
-
-
August 19, 2019 at 15:30 #26716
Since the customer doesn’t like tabs that much, most of it is happening on the default tab, but I’ll give it a try to use “Selected tab index” to call my function. Thank you!
-
August 19, 2019 at 18:06 #26718
If you only have one tab you should be able to use your code as long as you wrap the function call in a function like this:
function dffs_Ready(){ // Put your code or function call here }
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.