Repository: voxel51/fiftyone

Issue:
[BUG] APP non-JavaScript MIME type of "text/plain"
### System information

-   **OS Platform and Distribution**: Windows 10 Pro 10.0.18362.239
-   **FiftyOne installed from (pip or source)**:  pip
-   **FiftyOne version (run `fiftyone --version`)**: 0.9.3
-   **Python version**: both 3.8 | 3.9.2

### Commands to reproduce

```
Following installation steps on https://voxel51.com/docs/fiftyone/getting_started/install.html
pip install fiftyone
```

### Describe the problem

After installing the package (tested installing in both Anaconda environment and venv environment) and running the quickstart example, the app shows only blank screen with errors in console described in Other info / logs section.
The issue does not appear to be bound to specific settings with web browsers on the machine since the same error is given when running the fiftyone as remote on this machine and then accessing it from other machines, but rather by something with running web server as i could not reproduce this by installing fiftyone on other machines.

Any idea what might go wrong ?

### Code to reproduce issue

```
import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")
session = fo.launch_app(dataset)
```

### Other info / logs

Google Chrome: `Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.` 
for script 
`http://localhost:5151/_dist_/index.js`

Firefox: `Loading module from “http://localhost:5151/_dist_/index.js” was blocked because of a disallowed MIME type (“text/plain”).`


### What areas of FiftyOne does this bug affect?

-   [x] `App`: FiftyOne application issue
-   [ ] `Core`: Core `fiftyone` Python library issue
-   [ ] `Server`: Fiftyone server issue

### Willingness to contribute

-   [ ] Yes. I can contribute a fix for this bug independently.
-   [x] Yes. I would be willing to contribute a fix for this bug with guidance
        from the FiftyOne community.
-   [ ] No. I cannot contribute a bug fix at this time.



Discussion:
Hi @hydridity :wave: 

If the following command:

```bash
python -c "import mimetypes; print (mimetypes.guess_type('test.js'))"
```

does not return

```py
('application/javascript', None)
```

then you may need reconfigure the JS mime type manually on the Windows machine. I have a hunch there is a configuration issue on the machine. See [here](https://stackoverflow.com/questions/12003107/resource-interpreted-as-script-but-transferred-with-mime-type-text-plain-for-l)

If that does not seem to be the issue, of course let us know.

Ideally, we wouldn't rely on system configuration like this. So it is something I will look into.
Hi @benjaminpkane, thanks for the help.

Indeed, the issue was with this registry key being set to `text/plain`
Reconfiguration to `text/javascript` solved the problem.

Not sure how it ended in registry as `text/plain` though.

Resolving patch:
diff --git a/fiftyone/server/main.py b/fiftyone/server/main.py
--- a/fiftyone/server/main.py
+++ b/fiftyone/server/main.py
@@ -1398,6 +1398,12 @@ def set_headers(self):
         self.set_header("content-length", self.get_content_size())
         self.set_header("x-colab-notebook-cache-control", "no-cache")
 
+    def get_content_type(self):
+        if self.absolute_path.endswith(".js"):
+            return "text/javascript"
+
+        return super().get_content_type()
+
 
 class MediaHandler(FileHandler):
     @classmethod


Test patch: