Hi - I'd like to add a script tag (ld-json) to the top level window document but am unable to access the top level window document because of the iframe cross-domain restrictions.
Is there a way to:
- load the app at the top level (i.e. without the retool wrapper)?
- modify the top level document head otherwise?
Hey @tradesorg_chris!
I don't know that this is possible directly, the best solution I'm aware of would be similar to the one for your question here. You might try having a script that does something like:
const head = document.querySelector("head")l
const script = document.createElement("script");
script.type = "application/ld+json";
head.appendChild(script);
window.addEventListener(
"message",
(event) => {
script.innerHTML = JSON.stringify(event.data);
},
false
);
I'm not sure if that works for your use case though (e.g. I imagine it will get missed by search crawlers).