Last active
February 21, 2017 10:05
-
-
Save chengjianhua/51f71fd75c369abed18cefc794be8c43 to your computer and use it in GitHub Desktop.
the hack method that can make the title in weixin's webview be changable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hackSetTitle = (title) => { | |
document.title = title; | |
const iframe = document.createElement('iframe'); | |
iframe.src = '/favicon.ico'; | |
iframe.style.visibility = 'hidden'; | |
const listener = () => { | |
setTimeout(() => { | |
iframe.removeEventListener('load', listener); | |
setTimeout(() => { | |
document.body.removeChild(iframe); | |
}, 0); | |
}, 0); | |
}; | |
iframe.addEventListener('load', listener); | |
document.body.appendChild(iframe); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment