Skip to main content

Hello! Can I use Miro Web SDK if I embed my boards via iframe to my application? (I connected board as here Live Embed with BoardsPicker for registered users (miro.com))

I want to do that:

const item = await miro.board.get({ id: id })

await miro.board.viewport.zoomTo(item)

but I don’t understand how to get miro object from iframe in my application.


I tried to do that:
document.getElementsByClassName('miro-embedded-board')b0].contentWindow.miro, but I get error: Uncaught DOMException: Failed to read a named property 'miro' from 'Window': Blocked a frame with origin “https://my-link” from accessing a cross-origin frame.
    at HTMLDocument.<anonymous>

Thanks.

Hey Anatoly, thank you for reaching out us. By default it is not possible to access iframe’s JavaScript scope if the source has a different origin. It would be a huge security leak if you could do this.

If you’d like to have a Miro board loaded and focused on a specific widget from the start, you can you the `moveToWidget` parameter in the URL:

https://miro.com/app/live-embed/{board_id}/?moveToWidget={item_id}

More about the parameter you can find in documentation: https://developers.miro.com/docs/miro-live-embed-with-a-direct-link#set-the-initial-view-based-on-a-specific-board-item

 


Reply