Resource blocked due to MIME type

Home Forums Classic DFFS Resource blocked due to MIME type

Viewing 5 reply threads
  • Author
    Posts
    • #26265
      Andreas Blüher
      Participant

        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

      • #26267
        Alexander Bautz
        Keymaster

          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

        • #26269
          Alexander Bautz
          Keymaster

            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

          • #26678
            Andreas Blüher
            Participant

              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

              • #26687
                Alexander Bautz
                Keymaster

                  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

              • #26716
                Andreas Blüher
                Participant

                  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!

                • #26718
                  Alexander Bautz
                  Keymaster

                    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

                Viewing 5 reply threads
                • You must be logged in to reply to this topic.