Separate domain for HTML output
Datalore On-Premises allows you to use a separate dedicated domain for HTML outputs rendered as iframes in your code cell. The benefits of this feature are:
Guarantees security of iframe use in notebooks
Improves notebook performance through enabling static cache
note
You can continue working with HTML outputs without using a separate domain, but some of your iframes may crash due to security reasons.
- Use our domain
You set up your environment to use our domain, https://*.dataloreusercontent.com.
(Skip if using Datalore's domain) Deploy an HTML page with content as in the example below:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"/> <title>JetBrains Datalore</title> <script> (() => { const urlParams = new URLSearchParams(window.location.search); const frameId = urlParams.get('frameId'); function initialize() { window.parent.postMessage({ iframeToInitialize: frameId, }, '*'); } window.addEventListener("message", event => { if ("iframeContent" in event.data) { const iframe = document.getElementById("content") iframe.setAttribute("srcdoc", event.data.iframeContent) } }) window.addEventListener("DOMContentLoaded", () => initialize()); })() </script> <style> body, html { margin: 0; padding: 0; height: 100%; overflow: hidden; } #content { display: block; width: 100%; height: 100%; border: none; } </style> </head> <body> <iframe id="content"></iframe> </body> </html>
Specify the URL of the created page (our Datalore's dedicated domain) using the
USER_CONTENT_URL
environment variable in your config file.tip
To have your HTML outputs isolated, use the asterisk sign (*), which will be replaced with iframe ids when requesting the URL.
DockerHelmdocker-compose.yaml
services: datalore: ... environment: ... USER_CONTENT_URL: "your_domain_url"
datalore.values.yaml
dataloreEnv: .... USER_CONTENT_URL: "your_domain_url"
Thanks for your feedback!