Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect MIME/Content-Type for JavaScript on misconfigured Windows systems #4468

Merged
merged 2 commits into from Mar 27, 2019
Merged

Fix incorrect MIME/Content-Type for JavaScript on misconfigured Windows systems #4468

merged 2 commits into from Mar 27, 2019

Conversation

ghost
Copy link

@ghost ghost commented Mar 10, 2019

Problem

Tornado serves JavaScript files with Content-Type: text/plain, which causes the browser to reject loading the JavaScript, due to Strict MIME checking enabled in the last version. This problem appears to manifest only on Windows hosted notebooks.

Solution

Similar to the CSS fix, add in a mimetypes override for .js files

closes #4467

@raeperd
Copy link

raeperd commented Mar 12, 2019

thanks! it works very well now!
I love you!

@ejmoya
Copy link

ejmoya commented Mar 12, 2019

In w10 I have the same problem but it does not solve only with this. To solve it, I went to the directory "AppData\Local\Programs\Python\Python37\Lib\site-packages\notebook\templates" and edit the file "page.html" on line 18, changing the double quotes with single quotes.
Before:
<script src="{{static_url("components/es6-promise/promise.min.js")}}" type="text/javascript" charset="utf-8"></script>

After:
<script src="{{static_url('components/es6-promise/promise.min.js')}}" type="text/javascript" charset="utf-8"></script>

@lovettchris
Copy link

I had the blank page problem today, and this PR fixed it, thanks. Just had to do CTRL+F5 to force refresh and my Jupyter notebooks are back in business. Thanks!

@AnMa12
Copy link

AnMa12 commented Mar 17, 2019

I had the blank page problem today, and this PR fixed it, thanks. Just had to do CTRL+F5 to force refresh and my Jupyter notebooks are back in business. Thanks!

Thank you sir!

@ghost
Copy link
Author

ghost commented Mar 17, 2019

Thank you so much for fixing this, really hope this is merged soon.

@ghernie
Copy link

ghernie commented Mar 18, 2019

Thanks a lot mate !! It solved my MINE issue 👍

@deepandas11
Copy link

How to use this?

@BLGAmazingJ
Copy link

Thx^_^
Problem fixed.

@BLGAmazingJ
Copy link

How to use this?

You need to locate noteapp.py and override that part.

@gaborvecsei
Copy link

gaborvecsei commented Mar 23, 2019

Thanks for the fix! ❤️

@kzq666666
Copy link

I am still confused about the details of solution

@matt-bernhardt
Copy link

matt-bernhardt commented Mar 26, 2019

This sounds like it would solve the problem I've had when starting to work with Jupyter, but I'm not sure how to check out this branch (via pip) to confirm this.

I'm trying to use Jupyter with Windows 10 using any of Chrome, Firefox, or Edge. All three browsers exhibit the same behavior - a blank browser window, no apparent errors in the terminal console, but warnings and errors in the browser console relating to MIME type problems. I'm including screenshots here for reference.

image
image
image

Edit: paying close attention to BLGAmazingJ and the diff in this PR, I was able to find the right file and make this change manually. Once this was done, I no longer have the described problem.

@minrk
Copy link
Member

minrk commented Mar 27, 2019

Excellent, thank you!

@minrk minrk merged commit 7a13d5c into jupyter:master Mar 27, 2019
@minrk minrk changed the title Fix incorrect MIME/Content-Type for JavaScript Fix incorrect MIME/Content-Type for JavaScript on misconfigured Windows systems Mar 27, 2019
@minrk
Copy link
Member

minrk commented Mar 27, 2019

@meeseeksdev backport to 5.7.x

meeseeksmachine pushed a commit to meeseeksmachine/notebook that referenced this pull request Mar 27, 2019
minrk added a commit that referenced this pull request Mar 27, 2019
…8-on-5.7.x

Backport PR #4468 on branch 5.7.x (Fix incorrect MIME/Content-Type for JavaScript on misconfigured Windows systems)
@monocongo
Copy link

I have tried moving my version of notebook back to 5.7.4 but no luck so far. Can someone comment as to how I can build from source into my conda environment, in order to leverage the fix described in the comments above? Or will this fix be included in an upcoming release that I can utilize via conda update notebook?

BTW I have tried the following command, but it failed with a compilation error regarding a missing "bower" (which I was not able to find/install, so I gave up):

$ pip install git+git://github.com/jupyter/notebook@5.7.x

Thanks in advance for any assistance with this!

@minrk
Copy link
Member

minrk commented Mar 28, 2019

Working on publishing 5.7.7 now.

nodejs and npm are needed to build notebook from source.

@jamesmyatt
Copy link

Is there a way of fixing the root cause, i.e. that the registry has the wrong mime type?

@minrk
Copy link
Member

minrk commented Mar 28, 2019

I'm not a Windows expert, but from this, it appears to be in HKEY_CLASSES_ROOT\MIME\Database\Content Type. I think the root cause is installation of certain software may modify this database, perhaps as a way of associating itself as an opener for file extensions.

@minrk
Copy link
Member

minrk commented Mar 28, 2019

5.7.7 is on pypi

@jamesmyatt
Copy link

jamesmyatt commented Mar 28, 2019

Thanks, @minrk . I found it in HKCR\.js\Content Type (for Windows 10) and changing that also fixed this problem.

@EAly
Copy link

EAly commented Nov 19, 2019

Can anyone help how to apply this solution, i.e how to "add in a mimetypes override for .js files"?!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

notebook gives blank page when start