cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cannot load javascript from Dropbox - Incorrect Mime Type?

Cannot load javascript from Dropbox - Incorrect Mime Type?

KlausB
Helpful | Level 7

I am trying to load javascript code from Dropbox for use in personal bookmarklets. For instance, 

 

(function(){
    const url = 'https://www.dropbox.com/s/5cbb5dki3rnpdei/DebugSimple.js?raw=1';
    const e = document.createElement('SCRIPT');
    e.src=url;
    document.head.appendChild(e);
})();

 

However, when doing so I get the error message 

 

Cross-Origin Read Blocking (CORB) blocked cross-origin response 
https://<SOME_ID>.dl.dropboxusercontent.com/cd/0/inline/<SOME_LONG_ID>/file
with MIME type text/plain. See
https://www.chromestatus.com/feature/5629709824032768 for more details.

Likewise, if I use the ?dl=0 or ?dl=1 settings instead of ?raw=1, I get a complaint about the type being text/html.

I also tried using the fetch() API, but since the bookmarklets are executed in the context of third-party websites, their CORS header usually doesn't allow this.

Is it somehow possible to load javascript from Dropbox directly?

A similar question https://www.dropboxforum.com/t5/API-Support-Feedback/MIME-type-text-plain-is-not-executable/m-p/2712... has been marked as answered, but doesn't apply; I already have the correct file extension, and the issue still occurs.

1 Accepted Solution

Accepted Solutions

Re: Cannot load javascript from Dropbox - Incorrect Mime Type?

Greg-DB
Dropboxer

Based on the error message you shared, you're not getting exactly the same issue as the thread you linked to. It looks like you can still make this work using the modification mentioned there though, i.e., by changing your link to use 'dl.dropboxusercontent.com' initially, like this:

https://dl.dropboxusercontent.com/s/5cbb5dki3rnpdei/DebugSimple.js

Note that this isn't officially supported though, and is subject to change.

View solution in original post

2 Replies 2

Re: Cannot load javascript from Dropbox - Incorrect Mime Type?

Greg-DB
Dropboxer

Based on the error message you shared, you're not getting exactly the same issue as the thread you linked to. It looks like you can still make this work using the modification mentioned there though, i.e., by changing your link to use 'dl.dropboxusercontent.com' initially, like this:

https://dl.dropboxusercontent.com/s/5cbb5dki3rnpdei/DebugSimple.js

Note that this isn't officially supported though, and is subject to change.

View solution in original post

Re: Cannot load javascript from Dropbox - Incorrect Mime Type?

KlausB
Helpful | Level 7

It does work indeed, but the lack of official support is discouraging. The following thus works:

 

(function(){
    const url = 'https://dl.dropboxusercontent.com/s/5cbb5dki3rnpdei/DebugSimple.js?raw=1';
    const e = document.createElement('SCRIPT');
    e.src=url;
    document.head.appendChild(e);
})();
Who's talking

Top contributors to this post

  • User avatar
    KlausB Helpful | Level 7
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?