Skip to content

Conversation

@fonsp
Copy link
Collaborator

@fonsp fonsp commented Jan 5, 2024

Currently, when including the plotly.min.js locally in HTML, this is done using a file:// 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 open file://...something.html.

This PR uses Base64 to include the script using a data URL, which is supported in all environments, including http and https origins. 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

@pankgeorg
Copy link
Collaborator

pankgeorg commented Feb 2, 2024

This PR doesn't depend on #4862

I see #4884 as a better alternative to #4862 (which would defeat the purpose of having the plotly() backend, but the artifact there is 110MB, which is.. not ideal for a package that already takes a long time to ]add).

So my suggestion is, can we move forward with this PR (which unblocks the issue with file:/// URLS over insecure contexts, until we figure out a nice way to depend on the artifacts? (I also don't want to plagiarize this code in my other PR 😅)

@isentropic, @fonsp proactively thank you both 🙏🏽

@codecov
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (7cd27c4) 90.29% compared to head (32468f9) 89.77%.
Report is 30 commits behind head on master.

Files Patch % Lines
src/init.jl 0.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@BeastyBlacksmith BeastyBlacksmith merged commit 40281d0 into JuliaPlots:master Feb 5, 2024
@BeastyBlacksmith
Copy link
Member

Looks good to me and thanks for taking care 🙂

@fonsp fonsp mentioned this pull request Aug 14, 2025
7 tasks
BeastyBlacksmith added a commit that referenced this pull request Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] offline Plot in Pluto results in empty Plot

3 participants