How to preserve JS Embed Event message passing across page changes in iFrame

Knowledge Drop

Last tested: Sep 10, 2020
 

When navigating pages within an iFrame, the embed domain is dropped from the iFrame src then the parent page will no longer receiving messages. Meaning that if you are using JS embed events and are intending those to persist across page changes you will want to make sure that the "links" you are navigating to from within the iframe have the embed_domain= parameter (containing the parent page origin) appended to them.

This content is subject to limited support.                

Comments
KatieK
Participant I

I realized this is necessary when I stopped receiving events after navigation within the iframe - but how is it possible?

In an html section in particular. I don’t want to hard code something, we have so many different environments.

  dimension: link_to_dashboard{
sql: ${num} ;;
html: <a href="/embed/dashboards-next/lxZggFLq7XuorSFxlzIyK7?Number={{value}}">
<button>
Button Text
</button>
</a>
...}
jamesc633
Explorer

Is there any solution to persisting the embed domain here?

It’s a massive pain point for us at the minute as we have several dev environments per looker instance so hard coding the embed domain is a nightmare

Version history
Last update:
‎07-07-2021 01:50 PM
Updated by: