Skip to content

Commit 0c91cbb

Browse files
committed
Add blank.html for injected iframe content
1 parent 5d42969 commit 0c91cbb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

client/src/components/Visualizations/VisualizationFrame.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ const emitChange = debounce((newValue: string) => {
2323
const errorMessage = ref("");
2424
const iframeRef = ref<HTMLIFrameElement | null>(null);
2525
26+
const blankPageUrl = `${getAppRoot()}static/blank.html`;
27+
2628
async function render() {
2729
if (props.name) {
2830
try {
@@ -37,6 +39,12 @@ async function render() {
3739
3840
const iframe = iframeRef.value;
3941
if (iframe) {
42+
if (iframe.contentDocument?.readyState !== "complete") {
43+
await new Promise<HTMLIFrameElement>((resolve) => {
44+
iframe.onload = () => resolve(iframe);
45+
});
46+
}
47+
4048
const iframeDocument = iframe.contentDocument;
4149
if (iframeDocument) {
4250
const container = iframeDocument.createElement("div");
@@ -93,8 +101,9 @@ onMounted(() => render());
93101
</div>
94102
<iframe
95103
v-else
104+
class="position-relative h-100 w-100 border-0"
96105
id="galaxy_visualization"
97106
ref="iframeRef"
98-
class="position-relative h-100 w-100 border-0"
107+
:src="blankPageUrl"
99108
title="visualization" />
100109
</template>

static/blank.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><html><head></head><body></body></html>

0 commit comments

Comments
 (0)