Running Shiny App locally in Microsoft browsers gives browser errors


I'm new to Shiny, and having some trouble with odd, seemingly random errors. I have reduced my app down to a very basic form, given below. The issue I'm having is that when launching the app through RStudio, the plot will not load. In the browser console I can see that this is due to Javascript errors like this:

This never occurs in Chrome, but it will happen in Internet Explorer and Edge. In my full app the error in the browser console is not always the same--often it doesn't happen at all and the page loads just fine, but other times the error would reference crosstalk or DT (these are used in my full app). Often the plotly plot would load, but the DT table would not, or vice versa. It seems to happen independently on each page and with each element on the page; sometimes the first page would load fine, but then I would switch pages and an element would fail to load (again, with a browser console error). There is never any output in the R console.

In the pared down example below, I have been able to consistently reproduce the error through these steps:

  1. It only happens in Internet Explorer and Edge (works in Chrome), so one of these must be the default browser
  2. Restart the R session in RStudio
  3. Run the app with the "Run External" option in RStudio

This results in the plot failing to load and the error message in the browser console. It only occurs the first time after the R session has been restarted--any further attempts to run the App within the same R session will typically work flawlessly.

Any help would be much appreciated. I've been tearing my hair out over this one.


tb <- tibble(
  x = rnorm(100, mean = 10),
  y = rnorm(100, mean = 20),
  z = rnorm(100, mean = 30)

ui <- fluidPage(

      selectInput("x.axis", label = "X-Axis", choices = names(tb), selected = "x"),
      selectInput("y.axis", label = "Y-Axis", choices = names(tb), selected = "y")

server <- function(input, output, session) {
  output$plot <- renderPlotly({
    inputs <- c(input$x.axis, input$y.axis)

    p <-
      plot_ly(data = tb,
              type = "scatter",
              mode = "markers")
    p <- add_trace(p,
                   x = as.formula(paste0("~`", input$x.axis, "`")),
                   y = as.formula(paste0("~`", input$y.axis, "`")))

shinyApp(ui = ui, server = server)