Cloudera Data Science Workbench versions 1.4.2 (and higher) added a new feature that allowed users to enable HTTP security headers for responses to Cloudera Data Science Workbench.
Most visualizations require more than basic HTML. Embedding HTML directly in your console also risks conflicts between different parts of your code. The most flexible way to embed a web resource is using an IFrame:
library("cdsw") iframe(src="https://www.youtube.com/embed/8pHzROP1D-w", width="854px", height="510px")
from IPython.display import HTML HTML('<iframe width="854" height="510" src="https://www.youtube.com/embed/8pHzROP1D-w"></iframe>')
You can generate HTML files within your console and display them in IFrames using the /cdn folder. The cdn folder persists and services static assets generated by your engine runs. For instance, you can embed a full HTML file with IFrames.
library("cdsw") f <- file("/cdn/index.html") html.content <- paste("<p>Here is a normal random variate:", rnorm(1), "</p>") writeLines(c(html.content), f) close(f) iframe("index.html")
from IPython.display import HTML import random html_content = "<p>Here is a normal random variate: %f </p>" % random.normalvariate(0,1) file("/cdn/index.html", "w").write(html_content) HTML("<iframe src=index.html>")
Cloudera Data Science Workbench uses this feature to support many rich plotting libraries such as htmlwidgets, Bokeh, and Plotly.