fix passing title to the iframe
This commit is contained in:
+5
-2
@@ -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) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
window.parent.postMessage(JSON.stringify({ inited: true }), '*');
|
||||
</script>
|
||||
<script type="text/javascript" src="remark.js"></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user