Use data URL for local plotly asset#4863
Conversation
|
This PR doesn't depend on #4862 I see #4884 as a better alternative to #4862 (which would defeat the purpose of having the So my suggestion is, can we move forward with this PR (which unblocks the issue with @isentropic, @fonsp proactively thank you both 🙏🏽 |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #4863 +/- ##
==========================================
- Coverage 90.29% 89.77% -0.53%
==========================================
Files 40 40
Lines 8752 8780 +28
==========================================
- Hits 7903 7882 -21
- Misses 849 898 +49 ☔ View full report in Codecov by Sentry. |
|
Looks good to me and thanks for taking care 🙂 |
Currently, when including the
plotly.min.jslocally in HTML, this is done using afile://URL. Importing scripts using a file URL is only allowed in browsers if the page origin is also a file URL, i.e. if you openfile://...something.html.This PR uses Base64 to include the script using a data URL, which is supported in all environments, including
httpandhttpsorigins. This means that the plotly backend can be used with_use_local_dependencies[]in web-based IDEs like Pluto and other web sites.Fix #4854, depends on #4862