Cant .setSource


#1

this works

<script src="https://embed.runkit.com"></script>
<div id="my-element"></div>
<script>
    RunKit.createNotebook({
        element: document.getElementById("my-element"),
        source: "test"
    })
</script>

this doesnt

<script src="https://embed.runkit.com"></script>
<div id="my-element"></div>
<script>
    RunKit.createNotebook({
        element: document.getElementById("my-element"),
        onLoad: function(notebook) { notebook.setSource("test") }
    })
</script>

#2

Hi there,

I bet you’re probably loading the HTML file locally? Due to some browser restrictions in Chrome, we’re unable to postMessage back to the parent frame. So some of the API does appear to be broken. (we should look to see if there’s anything we can do about that).

In the meantime, Safari allows you to disable the local file restrictions, if you want, or you can spin up a server and serve it over HTTP: https://untitled-xkqjgn84z74k.runkit.sh/

(https://runkit.com/me1000/5a09d80db2a86d001217f6b5)


#3

Ok thanks, sadly it is still not working very well.

I cant setSource if i use readOnly and even if it is not set to read only after a short while setting the source stops working.