fix passing title to the iframe

This commit is contained in:
igoradamenko
2019-01-06 21:22:28 +02:00
parent 0da1a8c237
commit 566d5820ad
2 changed files with 7 additions and 2 deletions
+5 -2
View File
@@ -56,9 +56,7 @@ function init() {
window.addEventListener('message', receiveMessages);
window.addEventListener('hashchange', postHashToIframe);
document.addEventListener('click', postClickOutsideToIframe);
setTimeout(postHashToIframe, 1000);
postTitleToIframe(document.title);
new MutationObserver(mutations => postTitleToIframe(mutations[0].target.textContent)).observe(
document.querySelector('title'),
{ subtree: true, characterData: true, childList: true }
@@ -235,6 +233,11 @@ function init() {
userInfo.close();
}
}
if (data.inited) {
postHashToIframe();
postTitleToIframe(document.title);
}
} catch (e) {}
}
+2
View File
@@ -110,6 +110,8 @@
}
} catch (e) {}
}
window.parent.postMessage(JSON.stringify({ inited: true }), '*');
</script>
<script type="text/javascript" src="remark.js"></script>
</body>