diff --git a/src/components/PluginLoader.jsx b/src/components/PluginLoader.jsx index b2059e5..4640fd4 100644 --- a/src/components/PluginLoader.jsx +++ b/src/components/PluginLoader.jsx @@ -31,6 +31,26 @@ const injectHeaderbarHidingStyles = (event) => { } } +/** + * Set { + try { + const iframe = event?.target || document.querySelector('iframe') + const doc = iframe.contentDocument + const baseElement = doc.createElement('base') + baseElement.target = '_blank' + doc.head.appendChild(baseElement) + } catch (err) { + console.error( + 'Failed to inject element in client app.' + + 'This could be due to the client app being hosted on a different domain.', + err + ) + } +} + // todo: this is kinda duplicated between here and the header bar const getPluginEntrypoint = (appName, modules) => { // If core apps get a different naming scheme, this needs revisiting @@ -186,6 +206,7 @@ export const PluginLoader = ({ appsInfoQuery }) => { return } injectHeaderbarHidingStyles(event) + injectHtmlBaseTag(event) watchForHashRouteChanges(event) initClientOfflineInterface({ clientWindow: event.target.contentWindow,