Skip to content
AnthonyWeidner edited this page Apr 20, 2022 · 18 revisions

Web browser on local index.html file is blank?

The animint() function creates a local directory with HTML/JavaScript files to render the data viz, but these days most web browsers have a default setting which blocks execution of JavaScript from local files. The easiest way to solve this issue is by enabling local JavaScript execution in your web browser. For example in Firefox:

  • Open up a new tab. Type or paste about:config in the address bar and press Enter.
  • A button appears asking if you accept the risk to change advanced settings. Click that you accept the risk.
  • Type unique in the search box, which will filter the list for words containing this word.
  • Double click the privacy.file_unique_origin preference to switch the value from true to false

Or in Chrome follow this SO answer: https://stackoverflow.com/questions/20748630/load-local-javascript-file-in-chrome-for-testing/25107674

Alternately, if you can't turn on local JavaScript execution in your web browser for some reason, then you can try serving the animint html/JS using a local web server, which should work with any web browser. After rendering, animint2 prints a message which says to try using servr::httd("path/to/index.html") which should open a browser window with that URL. (and it should render the animint in that web page, whether or not you switch the privacy.file_unique_origin preference)

Alternatively, instead of using animint(viz) which saves/renders on your local computer, you can try animint2gist(viz) which saves the viz on GitHub Gist, and renders using bl.ocks.org. Beware that Gist imposes some limits. In March 2016 Gist imposed a maximum of 300 files per gist, and a maximum of 1 megabyte per file. The animint2gist function should stop with an error if your animint exceeds either of these limits. If you run into this problem, you may be able to use the chunk_vars option to edit the number and size of files produced by animint. Otherwise, try publishing your animint using one of the other sharing methods.

animint2gist Error Requires authentication

> animint2gist(viz)
Loading required namespace: gistr
Error: Requires authentication

  GitHub response headers suggest no or insufficient scopes
  To create gists you need the `gist` OAuth scope on your token.
In addition: Warning message:
In file.remove(vendor.path) :
  cannot remove file 'C:\Users\th798\AppData\Local\Temp\RtmpIF5jaZ\file3e20462d2234/vendor', reason 'Permission denied'

This happens if you have an old version of gistr, https://github.com/ropensci/gistr/issues/83 To fix you should re-install gistr and then restart R.

remotes::install_github("ropensci/gistr")
## restart R.
animint2gist(viz) # should work!

animint2gist() produces blank plot/web page?

If you are having difficulty properly loading gists onto the web page. you may be seeing this when running animint2gist():

Screen Shot 2022-04-19 at 11 10 34 PM

If other troubleshooting methods have not worked, there may be a library or package conflict from another program that you have run recently. You may have noticed this especially if animint2gist() was previously displaying your animint correctly on bl.ocks.org, but then after you ran code in another program that used a different set of libraries or created another animint that was not properly coded, your previously working animint now loads a blank web page.

Clone this wiki locally