admin管理员组文章数量:1332395
Adding to the question on Why does the HTML symbol for ▶ not work in document.title, when I add the play symbol to the document title using the properly escaped javascript hex value, the symbol seems squished:
JavaScript:
document.title = '\u25BA' + document.title;
Inside Page (correct)
Inside Title (not so correct)
See this fiddle for a working model. I've added /show/light
so the javascript can actually access the document title on the main page, but if you take off the extension, you can see the code as well.
jsFiddle
This appears to be happening on all major browsers (Chrome, Firefox, IE).
Tested (on Win8) in:
- Chrome: version 30.0
- Firefox: version 22.0
- IE: version 10.0
When I go to YouTube, it looks fine, so I'm not positive it's a Browser Specific Issue.
Adding to the question on Why does the HTML symbol for ▶ not work in document.title, when I add the play symbol to the document title using the properly escaped javascript hex value, the symbol seems squished:
JavaScript:
document.title = '\u25BA' + document.title;
Inside Page (correct)
Inside Title (not so correct)
See this fiddle for a working model. I've added /show/light
so the javascript can actually access the document title on the main page, but if you take off the extension, you can see the code as well.
jsFiddle
This appears to be happening on all major browsers (Chrome, Firefox, IE).
Tested (on Win8) in:
- Chrome: version 30.0
- Firefox: version 22.0
- IE: version 10.0
When I go to YouTube, it looks fine, so I'm not positive it's a Browser Specific Issue.
Share Improve this question edited May 23, 2017 at 12:01 CommunityBot 11 silver badge asked Oct 14, 2013 at 4:12 KyleMit♦KyleMit 30.4k72 gold badges510 silver badges701 bronze badges 3- Maybe because the font is based on the OS/Browser? It seems to be displaying fine on Chromium+Ubuntu. Can you include the OS/Browser so we can check accordingly? – godfrzero Commented Oct 14, 2013 at 4:17
- I've noticed the effect in Firefox with YouTube. on Windows. I've assumed it was an OS font issue and beyond the scope of anything that you could control in CSS or JavaScript – Jason Sperske Commented Oct 14, 2013 at 4:17
- If nothing else works properly throughout all environments, you could probably try changing the favicon dynamically instead. – godfrzero Commented Oct 14, 2013 at 4:22
1 Answer
Reset to default 6By Pasting the symbol that YouTube uses (▶) into codepoints, you can see that they are actually using a different unicode version. The character returned is U+25B6
(not to be confused with 25B8
and 25BA
)
This should look better:
function PrependPageTitle(player) {
var playIcon = '\u25B6 ';
var startsWithIcon = document.title.substring(0, playIcon.length)===playIcon;
if (player.paused && startsWithIcon) {
document.title = document.title.slice(playIcon.length);
} else if (!player.paused && !startsWithIcon) {
document.title = playIcon + document.title;
}
}
Demo Here:
jsFiddle
本文标签: javascriptPlay symbol (▶) squished in documenttitleStack Overflow
版权声明:本文标题:javascript - Play symbol (▶) squished in document.title - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742283462a2446516.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论