在浏览器标签标题中添加一个空格 [英] Add a space to the browser-tab title

查看:44
本文介绍了在浏览器标签标题中添加一个空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个强大的网络爬虫等标题...... L.A.Takedown//The Band - bla bla... ~ 但对于 style - 我想要一个很酷的页面标题.我希望图标是洛杉矶 logo...

我为页面创建了一个新标题...书呆子警报

var newTitle = 'Takedown';

然后,像这样插入......

document.title = newTitle;

然后我得到这个:

我对此非常满意...但我希望在Takedown"字符串之前有一点空间/这是我通常应该理解的...

似乎字符串就是这样做的: 中等数学空格字符似乎有效:

document.title = ' \u205f 移除';

I have a robust title for web-crawlers etc... L.A. Takedown // The Band - bla bla... ~ but for style - I want a cool looking page title. I want the favicon to be the LA logo...

I create a new title for the page... nerd alert

var newTitle = ' Takedown';

Then, inserting it like this...

document.title = newTitle;

Then I get this:

I am very pleased with this... but I would love a little space before the 'Takedown' string / which is something I should understand in general...

It seems like strings just do this: http://codepen.io/sheriffderek/pen/YXxyqQ ( I mean... strip the space at the beginning and end)

But I can add   and replace the spaces for markup... but the document / browser tab isn't down with that...

So, why is this string having it's spaces stripped... '__Takedown' - and how can I force a space in there... ??? - in a non-markup situation?

Here is the CodePen breakdown of the ideas so far... and @moogs idea works in theory --- but the tab still doesn't reflect even though the spaces appear in the head as seen here ->

If your answer is "the space doesn't matter - it's fine how it is..." or something like that.. just save yourself some time and don't reply. This is just an example.


This is what I want to happen...

解决方案

Looks like browsers trim leading white space characters, but the unicode 205f medium mathematical space character seems to work:

document.title = '​​\u205f​​​ Takedown';

这篇关于在浏览器标签标题中添加一个空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆