hrbrmstr / 2023-nyr-webr

🕸️ Into the WebR-Verse
7 stars 0 forks source link

Safari is not showing the R code entries #1

Open spholmes opened 1 year ago

spholmes commented 1 year ago

Using chrome I can see a white R code window with sessionInfo() and any R code I type and then I can run the code.

Using safari, although I get the green bullet with ready!, there is nothing showing in the code window.

Using firefox it works fine, just like with chrome..

DanielEWeeks commented 1 year ago

Re the question I posted on Mastodon:

One question re the webR slide https://rud.is/w/2023-nyr-webr/#/section-2: If I use the Chrome browser, the embedded 'session.info()' webR code shows up in the editor window and runs fine, but if I use the Safari browser, the editor window display the line of R code, and the JavaScript console says "Loading "vs/editor/editor.main" failed." Any idea why? Is there some security setting in Safari that doesn't like webR?

When I view the WebR window in this slide:

https://rud.is/w/2023-nyr-webr/#/section-2

on a Mac Book Air M1 with Safari Version 16.4.1, nothing shows in the code window.

With Chrome Version 114.0.5735.198 (Official Build) (arm64) and with Firefox 115.0.2 (64-bit), the WebR window in the slide works fine.

DanielEWeeks commented 1 year ago

Ran into the same Safari issue previously when trying out WebR chunks in a Quarto book (https://danieleweeks.github.io/HuGen2071/webR_test.html), but thought maybe that was because GitHub.io might not yet allow Cross-Origin-Resource-Policy headers. But it also doesn't work at https://hugen2071.netlify.app/webr_test where I think I have implemented the headers correctly.

The code for the example "WebR - R in the web browser" chapter is simple (https://github.com/DanielEWeeks/HuGen2071/blob/main/webR_test.qmd):

---
title: WebR - R in the web browser
webr:
  packages: ['ggplot2']
---

This is a WebR-enabled code cell in a Quarto HTML document which works when viewed in a Chrome browser.

``` {webr-r}
# Edit/add code here
fit = lm(mpg ~ am, data = mtcars)
summary(fit)