# Embeding Observable notebboks depends on navigators ?

**URL:** <https://talk.observablehq.com/t/embeding-observable-notebboks-depends-on-navigators/10452>\
**Category:** Help\
**Created:** [June 19, 2025, 6:47am UTC](https://talk.observablehq.com/t/embeding-observable-notebboks-depends-on-navigators/10452 "2025-06-19T06:47:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![linard-y](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/linard-y/32/8937_2.png) [@linard-y](https://talk.observablehq.com/u/linard-y)\
**Post date:** [June 19, 2025, 6:47am UTC](https://talk.observablehq.com/t/embeding-observable-notebboks-depends-on-navigators/10452/1 "2025-06-19T06:47:09Z")

</div>

Hey everyone,  
I’m having trouble embeding a notebook into my React web page (Next.js to be precise). I’m used to using Firefox and everything works fine, but I wanted to test viewing my site with Chrome and there’s an error. Is there anything special I need to do to support all browsers?

Here’s a specific example:  
I integrate the [@linard-y/from-her-to-eternity](https://observablehq.com/@linard-y/from-her-to-eternity) notebook as a package in my website (`pnpm add https://api.observablehq.com/@linard-y/from-her-to-eternity.tgz?v=3`). Then I have a React component named **ObservableNotebook.jsx** defined like this:

```auto
import React, { useRef, useEffect } from 'react';
import { Runtime, Inspector, Library } from '@observablehq/runtime';

const mountId = 'mdx-container-div';
const stdlib = new Library();
const library = Object.assign({}, stdlib, { width: width_mdx });

function ObservableNotebook({ notebook, cells, customClassName }) {
    const refs = useRef(cells.map(() => React.createRef()));
    useEffect(() => {
        const runtime = new Runtime(library);
        runtime.module(notebook, name => {
            const index = cells.indexOf(name);
            if (index !== -1) { return new Inspector(refs.current[index].current); }
        });
        return () => runtime.dispose();
    }, [notebook, cells]);

    return (
        <div className={customClassName}>
            {refs.current.map((ref, index) => ( <div key={index} ref={ref} />))}
        </div>
    );
}

export default ObservableNotebook;

```

In my MDX page, I import

```auto
import styles from '@/styles/contours.module.css'
import notebook from "@linard-y/from-her-to-eternity"
import ObservableNotebook from '@/components/blog/post-components/ObservableNotebook';

```

then somewhere in the page I use the component ObservableNotebook to declare the cells to be displayed:

```auto
<ObservableNotebook notebook={notebook} cells={["viewof targetProjection","Render_Proj"]} customClassName={styles.reprojection} />

```

Firefox users will see that it works very well here (at the bottom of the page) :  
[https://mo-omgaia.vercel.app/blog/posts/contours](https://mo-omgaia.vercel.app/blog/posts/contours)  
While Chrome users will get an error :

```auto
Render_Proj = RuntimeError: Cannot read properties of undefined (reading 'index')

```

Does anyone have an idea how to solve my problem?

---

<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:** [June 19, 2025, 9:39am UTC](https://talk.observablehq.com/t/embeding-observable-notebboks-depends-on-navigators/10452/2 "2025-06-19T09:39:54Z")

</div>

I can see the notebook itself failing in Chrome and Safari. ~~The console error suggests that `convert` cannot find the file, so my suspicion would be that you have a race condition somewhere in your notebook where you try to read the file before it has been fully imported into the in-memory file system.~~

… Actually, it seems to work in Chrome if I select at least one of the color layers. The third layer (red) appears to be missing in Chrome.

---

<div class="post-metadata">

**Author:** ![linard-y](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/linard-y/32/8937_2.png) [@linard-y](https://talk.observablehq.com/u/linard-y)\
**Post date:** [June 19, 2025, 10:41am UTC](https://talk.observablehq.com/t/embeding-observable-notebboks-depends-on-navigators/10452/3 "2025-06-19T10:41:39Z")

</div>

The notebbok in [Observablehq.com](http://Observablehq.com) runs as I want (in Chrome or in Firefox) but the trouble comes when it is embed in my website.

---

<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:** [June 19, 2025, 11:47am UTC](https://talk.observablehq.com/t/embeding-observable-notebboks-depends-on-navigators/10452/4 "2025-06-19T11:47:03Z")

</div>

Then we’re clearly not seeing the same thing. This is a screenshot of your notebook in Chrome 137 on macOS:

 ![Screenshot 2025-06-19 at 13.45.19](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/c/c039c7168e977e3f746b7da4342560d97df59903.jpeg)

---

<div class="post-metadata">

**Author:** ![linard-y](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/linard-y/32/8937_2.png) [@linard-y](https://talk.observablehq.com/u/linard-y)\
**Post date:** [June 19, 2025, 1:25pm UTC](https://talk.observablehq.com/t/embeding-observable-notebboks-depends-on-navigators/10452/5 "2025-06-19T13:25:20Z")

</div>

Thank you for your help. Indeed, the notebook behaves differently depending on the browser, even in its original version on [Observable.com](http://Observable.com).  
The difference seems to start when using the external wasm-imagemagick library. I’ll see how I can get around the problem by not using this library.

---

<div class="post-metadata">

**Author:** ![linard-y](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/linard-y/32/8937_2.png) [@linard-y](https://talk.observablehq.com/u/linard-y)\
**Post date:** [June 22, 2025, 6:38pm UTC](https://talk.observablehq.com/t/embeding-observable-notebboks-depends-on-navigators/10452/6 "2025-06-22T18:38:07Z")

</div>

I discovered that image and color management differed between Firefox and Chrome. I worked around my problem without really understanding everything; but at least it works for both browsers now.
