Incorrect MIME type when hosting on Google Drive

Viewed 80

I've found some answers on here of people hosting JS files on Google Drive but am running into an issue. I am attempting to grab a JS file I have hosted on Google Drive and run the script. But I am getting the error:

Read Blocking (CORB) blocked cross-origin response https://drive.google.com/uc?export=download&id=1WzzhFnPpDyfybrp-QG4xQf2WFLOTpLDL with MIME type text/html.`

This is how I am trying to call the script:

<script type="text/javascript" src="https://drive.google.com/uc?export=download&id=1WzzhFnPpDyfybrp-QG4xQf2WFLOTpLDL"></script>
1 Answers

When I saw your script and URL, I'm worried that when the file is exported using your endpoint, the virus check might be affected. So, in this case, how about directly downloading your file using an API key?

When your endpoint is modified, it becomes as follows.

From

<script type="text/javascript" src="https://drive.google.com/uc?export=download&id=1WzzhFnPpDyfybrp-QG4xQf2WFLOTpLDL"></script>

To

<script type="text/javascript" src="https://www.googleapis.com/drive/v3/files/1WzzhFnPpDyfybrp-QG4xQf2WFLOTpLDL?alt=media&key=###your API key###"></script>
  • When I tested this modified endpoint, no error occurs.

Reference:

Related