-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
websocket script is added to embedded iframes #25
Comments
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. |
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? |
Okay, now you can use an HTML comment 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")) |
Perfect! Thanks for considering this case. I can verify that it has provided me a way to fix my issue. |
If I am serving html through servr that embeds iframes, the iframe html also gets tagged with the websocket script. I think this can lead to conflicts wrt which websocket connection to honor (is the iframe reloaded or the page?).
Inspecting the served page:
In this situation, subsequent edits to index.html don't always guarantee a refresh of index.html.
The text was updated successfully, but these errors were encountered: