mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-22 14:31:13 +02:00
fix detached window updation in webapp
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
window.addEventListener('message', e => {
|
||||
document.querySelector('iframe').src = e.data;
|
||||
if (e.data && e.data.contents) {
|
||||
const frame = document.querySelector('iframe');
|
||||
frame.src = frame.src;
|
||||
setTimeout(() => {
|
||||
frame.contentDocument.open();
|
||||
frame.contentDocument.write(e.data.contents);
|
||||
frame.contentDocument.close();
|
||||
}, 10);
|
||||
} else {
|
||||
document.querySelector('iframe').src = e.data;
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user