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

Use data URL for local plotly asset #4863

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

fonsp
Copy link
Contributor

@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
Contributor

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 🙏🏽

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
11 of 16 checks passed
@BeastyBlacksmith
Copy link
Member

Looks good to me and thanks for taking care 🙂

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