Created
June 13, 2016 06:47
-
-
Save logzh/8e0f1c2aff3c4ec72e6bbdc299750de6 to your computer and use it in GitHub Desktop.
如何通过 js 修改微信浏览器的title?
This file contains 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
var $body = $('body'); | |
document.title = ‘title’ | |
// hack在微信等webview中无法修改document.title的情况 | |
var $iframe = $('<iframe src="/favicon.ico"></iframe>').on('load', function() { | |
setTimeout(function() { | |
$iframe.off('load').remove() | |
}, 0) | |
}).appendTo($body) | |
// https://www.zhihu.com/question/26228251 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment