In Chrome, right-mouse-click on the page and select Inspect, then choose the Console tab from the pane that appears in the righthand side of the browser. This gives the JavaScript console.
OK, I think I manged to access the console. here are the errors in Chrome
Access to script at 'https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
bokeh-2.1.1.min.js:1 Failed to load resource: net::ERR_FAILED
test.html:21 Uncaught ReferenceError: Bokeh is not defined at test.html:21
test.html:49 Uncaught ReferenceError: Bokeh is not defined at HTMLDocument.fn (test.html:49)
Your code works for me as expected using Chrome 84.0.4147.125 and bokeh 2.1.1 on Mac OS X. My python version with this environment is 3.8.3 as part of the current Anaconda distribution.
Unfortunately, I cannot reproduce the problem in my environment, but hopefully this data point helps narrow down other aspects that might cause the difference due to operating system and/or package differences.
Thanks everyone. I solved the problem with Chrome by cleaning the cache as suggested. However, I cannot open it with IE 11 (still having blank page with it). I tried to clean the history also in IE 11, but I could not solve the issue.
Considering that I have to share the file with my colleagues and that IE11 is still used in our company PCs I will downgrade to bokeh 1.4.0 that was working OK with IE 11 too.
As reported above I do not get any error in the IE11 console. Actually I do not get anything.
By the way, from what I could understand with my limited knowledge and the link provided, is that IE11 does not support ES6, i.e. a new javascript platform (?). It also appears that IE11 will not be supported anymore after August 2021. So this should be just a problem for this year only.
However, I found this post:
where someone suggests to use a transpiler such as Babel. Actually I did not get it. I have the impression that Babel offers a platform to simply write and test scripts. Is there any possibility to use Babel to make a bokeh generated page work on IE11?
If you need to support viewers using IE you will have to use “legacy” resource Bundles, which are currently busted as it happens, but should be fixed in 2.2 due to be released on Monday. You can use bokeh.resources.INLINE_LEGACY or pass legacy=True to a Resources object yourself. (Presumably setting CDN.legacy = True might also work tho I have not tried)
It also appears that IE11 will not be supported anymore after August 2021. So this should be just a problem for this year only.
Well, there will undoubtedly be IE users even after that date, but more relevant for our actual work, even today IE usage is down to only ~3% worldwide. Looking only at Bokeh CDN logs, IE usage is even lower. The economic realities of finite project resources means sometimes we have to pick and choose and prioritize, which is why we have already largely jettisoned IE support, modulo legacy resource bundles.
Thanks for the tip. I modified my script as follows:
from bokeh.plotting import figure
from bokeh.io import output_file
from bokeh.models import ColumnDataSource
from bokeh.embed import file_html
from bokeh.resources import INLINE_LEGACY
df = {'x': [1.,2.,3.,4.,5.], 'y': [1.,2.,3.,4.,5.]}
source = ColumnDataSource(df)
p = figure()
p.line('x', 'y', source=source)
p.circle('x', 'y', source=source)
resources = INLINE_LEGACY
outputfilename = 'test.html'
output_file(outputfilename)
with open(outputfilename, 'w') as f:
f.write(file_html(p, resources, 'Test Page'))
However, I am still incapable to visualise the page with IE11. I noticed a difference though. The inline option made the page available off line (the js script is entirely written on the html page).
I have the impression that the legacy option is not really working. In this regard, I found this post that could be related:
Many apologies for that. I did not read very carefully the first part of your previous post. Thanks again. Looking forward to test the new version of the module.
You’ll have to use something like CDN.legacy = True which I did verify worked on IE 11 before the release. Otherwise you need to be more specific about exactly what you tried.
I had the same problem. I solved with the suggested command as pointed out in the previous post. However, I lost the “inline” option that granted me the possibility to open the html page offline.