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

Offline #10

Open
zsunberg opened this issue Oct 13, 2017 · 11 comments
Open

Offline #10

zsunberg opened this issue Oct 13, 2017 · 11 comments

Comments

@zsunberg
Copy link
Member

Right now the package downloads d3 on the fly, so it will not work without the internet, as I found out painfully in a presentation. I guess we should download d3 into deps

@zsunberg
Copy link
Member Author

zsunberg commented Oct 13, 2017

Tasks are

  • make javascript load a local js file into the dom head
  • figure out where to store the js file
  • make build.jl download jquery and d3 locally when the package is built

@zsunberg
Copy link
Member Author

zsunberg commented Nov 8, 2017

Unfortunately I have no idea about how to make the browser load a script from a local file - I think it is a security hazard of some kind. I've done a fair amount of googling, but javascript development for offline use is not a popular topic, so I am not going to fix it until I can talk to someone who has lots of javascript/jupyter experience :(.

The issue is similar to this: JuliaLang/IJulia.jl#345

@zsunberg
Copy link
Member Author

Maybe it can be fixed with this https://github.com/EricForgy/Pages.jl

@pilgrimygy
Copy link

When I used D3Tree, I find a problem but I can't solve it. Perhaps you can help me to solve it. Thank you very much!
Here's my question:
Traceback (most recent call last):
File "C:/Users/pilgrim/Desktop/code/effecitive_python.py", line 7, in
Main.include("test.jl")
ImportError: Julia exception: LoadError: IOError: could not spawn cmd /C start chrome 'C:\Users\pilgrim\AppData\Local\Temp\jl_vy8tX5\tree.html': no such file or directory (ENOENT)
Stacktrace:
[1] _spawn_primitive(::String, ::Cmd, ::Array{Any,1}) at .\process.jl:99
[2] #550 at .\process.jl:112 [inlined]
[3] setup_stdios(::Base.var"#550#551"{Cmd}, ::Array{Any,1}) at .\process.jl:196
[4] _spawn at .\process.jl:111 [inlined]
[5] run(::Cmd; wait::Bool) at .\process.jl:439
[6] run at .\process.jl:438 [inlined]
[7] inchrome(::D3Tree) at C:\Users\pilgrim.julia\packages\D3Trees\CDEyE\src\displays.jl:15
[8] top-level scope at C:\Users\pilgrim\Desktop\code\test.jl:10
[9] include(::String) at .\client.jl:439
[10] #invokelatest#1 at .\essentials.jl:712 [inlined]
[11] invokelatest(::Any, ::Any) at .\essentials.jl:711
[12] _pyjlwrap_call(::Function, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at C:\Users\pilgrim.julia\packages\PyCall\zqDXB\src\callback.jl:28
[13] pyjlwrap_call(::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at C:\Users\pilgrim.julia\packages\PyCall\zqDXB\src\callback.jl:49
in expression starting at C:\Users\pilgrim\Desktop\code\test.jl:10

I only use the function: inchrome.

@zsunberg
Copy link
Member Author

@pilgrimygy it looks like your system was not able to start chrome. Do you have google chrome installed and does the command start chrome work in the command line?

@zsunberg
Copy link
Member Author

If you have a different browser installed, consider using inbrowser instead of inchrome.

@pilgrimygy
Copy link

pilgrimygy commented Jul 15, 2020 via email

@nsajko
Copy link

nsajko commented Sep 19, 2022

Unfortunately I have no idea about how to make the browser load a script from a local file - I think it is a security hazard of some kind.

Yeah, this limitation is borne out of CORS rules: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

The fix is easy, just serve all the files from a local Web server.

@nsajko
Copy link

nsajko commented Sep 19, 2022

If you're targeting just the Chromium/Chrome browser, a possible workaround is to specify the --disable-web-security command line flag when starting the Chromium process: https://peter.sh/experiments/chromium-command-line-switches/#disable-web-security

@nsajko
Copy link

nsajko commented Sep 19, 2022

Another workaround, but not just for Chromium, would be to include the JS and other dependencies in the HTML file that you generate.

@zsunberg
Copy link
Member Author

Thanks for the clarifying comments @nsajko ! I don't have time to personally work on this at the moment, but it would be nice for someone to implement one of these ideas. Would prefer something that works in all browsers and Jupyter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants