GithubHelp home page GithubHelp logo

Comments (4)

yihui avatar yihui commented on May 20, 2024

That is an interesting issue. I thought for a while but I don't know what to do in this case. I cannot simply disable the websocket in the iframe, since RStudio viewer is essentially an iframe.

from servr.

hafen avatar hafen commented on May 20, 2024

True. I realize this is a bit of an edge case. It's probably a reasonable expectation for users to want to use iframes but in many cases it might point to something served from somewhere else, in which case this wouldn't be an issue (right?).

For my case, I have a master page allows the user to page through other pages created through servr, embedded in iframes (see here: http://ryanhafen.com/blog/rmote). The updating behavior isn't consistent (sometimes the iframe updates, sometimes the index).

I wonder how easy / reasonable it would be to add a check in the websockets javascript for a variable that indicates not to connect. I could then explicitly set the variable in the pages I don't want the script to be applied to. What do you think?

from servr.

yihui avatar yihui commented on May 20, 2024

Okay, now you can use an HTML comment <!-- DISABLE-SERVR-WEBSOCKET --> to disable the websocket on an HTML page, e.g.

library(servr)
library(htmltools)
tmpd <- tempdir()
httw(dir = tmpd, daemon = TRUE, pattern = "index.html")
save_html(HTML("iframecontent <!-- DISABLE-SERVR-WEBSOCKET -->"), file = file.path(tmpd, "iframe.html"))
save_html(tagList(tags$p("test1"), tags$iframe(src = "iframe.html")),
  file = file.path(tmpd, "index.html"))

from servr.

hafen avatar hafen commented on May 20, 2024

Perfect! Thanks for considering this case. I can verify that it has provided me a way to fix my issue.

from servr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.