# Embedded Notebooks - redefine

**URL:** <https://talk.observablehq.com/t/embedded-notebooks-redefine/10471>\
**Category:** Help\
**Created:** [July 10, 2025, 2:15pm UTC](https://talk.observablehq.com/t/embedded-notebooks-redefine/10471 "2025-07-10T14:15:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BMPMS](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/bmpms/32/9441_2.png) [@BMPMS](https://talk.observablehq.com/u/BMPMS)\
**Post date:** [July 10, 2025, 2:15pm UTC](https://talk.observablehq.com/t/embedded-notebooks-redefine/10471/1 "2025-07-10T14:15:53Z")

</div>

Hi folks,

I’ve been hosting a notebook using Javascript on my site and I’ve been using a select box to change the language using.

import {Runtime, Inspector} from “[https://cdn.jsdelivr.net/npm/@observablehq/runtime@5/dist/runtime.js](https://cdn.jsdelivr.net/npm/@observablehq/runtime@5/dist/runtime.js)”;  
import define from “[https://api.observablehq.com/@bmdatavisualisation/apt.js?v=4](https://api.observablehq.com/@bmdatavisualisation/apt.js?v=4)”;  
const notebook = new Runtime().module(define, name =\> {  
if (name === “finalChart”) return new Inspector(document.querySelector(“#observablehq-finalChart-92d14b0e”));  
});

notebook.redefine(“language”, “pt”)

It’s being hosted on another site within an iframe (I don’t have access) and I had the smart idea that if they set up a message then I could detect when the url changes so that I could dynamically change the language.

It doesn’t seem to be working - I’m guessing something to do with state/runtime/the fact that it’s hosted on another site within a iframe and might not even be possible to do but thought I’d ask…

Many thanks,

Bryony

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [July 11, 2025, 8:53am UTC](https://talk.observablehq.com/t/embedded-notebooks-redefine/10471/2 "2025-07-11T08:53:15Z")

</div>

What have you tried specifically to access the language? And is the iframe sandboxed or served from a different origin than its parent page?

---

<div class="post-metadata">

**Author:** ![BMPMS](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/bmpms/32/9441_2.png) [@BMPMS](https://talk.observablehq.com/u/BMPMS)\
**Post date:** [July 11, 2025, 9:07am UTC](https://talk.observablehq.com/t/embedded-notebooks-redefine/10471/3 "2025-07-11T09:07:04Z")

</div>

Thank you @mootari. I set up a page on my website as an example of how a notebook could be hosted and they ended up embedding the whole page.

I found a solution though - I’m detecting the language from the url search string which they are now changing within the iFrame if the user switches language.. Thank you for reaching out.
