What is meta? ×

So, I see that SO has moved to put the most popular tag in the beginning of the <title> to fight site scrapers. But, this is harmful to User Experience. With browsers like Google Chrome, all I can see is the first few characters of the title, and it becomes annoying to try to find the right tab.

So, my request: Can you remove the tag from the <title> using JavaScript? Crawlers will still see the SEO-friendly <title>, and users won't have their user experience hampered by it. We all win.

share|improve this question
Queue the greasemonkey scripters... –  Mark Henderson Dec 10 '10 at 22:59
@Farseeker Why do we need them in FIFO format? ♪ –  Grace Note Dec 11 '10 at 0:09
@grace - sorry, I don't get it? –  Mark Henderson Dec 11 '10 at 3:18
@Farseeker en.wikipedia.org/wiki/FIFO –  Yahel Dec 11 '10 at 3:22
Oh. I know what FIFO is, but not sure how that relates to my comment –  Mark Henderson Dec 11 '10 at 4:24
@Farseeker: Your usage of "queue" in that context was an irresistible "cue" for the language lawyers to assemble themselves into a "FIFO" for the purpose of teasing you. –  Jim Lewis Dec 11 '10 at 5:44
@Jim - oh, right. I'm not a programmer - hence why I'm guessing I didn't get the joke (still not sure if I do, but I think we'll just leave it be). –  Mark Henderson Dec 12 '10 at 1:27

2 Answers 2

up vote 23 down vote accepted

While SOIS might not want to do it, we, as the user, can. And the script is absolutely ridiculously simple - so simple that I'm surprised nobody has posted it yet. Ah well, free Meta rep here I come:

// ==UserScript==
// @name          StackExchange Title Tag Remover
// @namespace     yijiang
// @include       http://superuser.com/questions/*
// @include       http://serverfault.com/questions/*
// @include       http://askubuntu.com/questions/*
// @include       http://answers.onstartups.com/questions/*
// @include       http://nothingtoinstall.com/questions/*
// @include       http://seasonedadvice.com/questions/*
// @include       http://crossvalidated.com/questions/*
// @include       http://stackapps.com/questions/*
// @include       http://*.stackexchange.com/questions/*
// ==/UserScript==

if(!isNaN(parseInt(window.location.pathname.split('/')[2]), 10)){
    var title = document.getElementsByTagName('h1')[0];
    title = title.innerText || title.textContent;
    document.title = title + document.title.substring(document.title.lastIndexOf('-') - 1);

Install - Source

However, because of the fact that userscripts can only run after the page has loaded the tags will still appear for a fraction of a second after the page starts loading.

Edit: Meta sites now removed because they won't have this "feature" according to Jeff Atwood

share|improve this answer
It's been posted, maybe here, maybe on Webmasters. You can't do it like this though - tag isn't always included and if the title when it isn't has a hyphen...oops. Pull the question title out of the page and use that instead. –  Rebecca Chernoff Dec 11 '10 at 2:40
@RebeccaChernoff Fixed that, thanks :P –  Yi Jiang Dec 11 '10 at 3:01
This would also rewrite page names like "User Arjan - Stack Overflow" into "Arjan - Stack Overflow", and remove the title from "Ask a question" or when editing a post? If that's a problem, then I guess one could throw in jQuery (loaded anyhow) and use var title = $("#question-header h1").text();. Next, only replace if title has a value. –  Arjan Dec 12 '10 at 9:49
@Arjan It shouldn't - the @include rules will stop it from running on the user pages, and the first if statement will stop it from running on /question/ask pages. Also, because of userscript sandboxing, you can't "just" throw in a little jQuery - you'll have to use unsafeWindow for GM, and, even worse, script injection for Chrome –  Yi Jiang Dec 12 '10 at 10:27
Ah, you're totally right! (I should have seen the @include but still glad I commented, as I didn't know about that jQuery usage. Thanks!) –  Arjan Dec 12 '10 at 10:58
Would you submit it to userscripts.org (or host it on your own site) for easier installation please? –  hheimbuerger Dec 17 '10 at 18:17
@hheimbuerger Done! –  Yi Jiang Dec 18 '10 at 2:25
@Yi Jiang Awesome, thanks. I've already been using it since yesterday, and so far it seems to work fine. –  hheimbuerger Dec 18 '10 at 13:20
You should add this to the StackApps scripts section: stackapps.com/?tab=scripts –  Yahel Feb 23 '11 at 18:55

I don't know - Google frowns on that kind of thing (showing a different visual presentation to the user vs the search engine). It could have severe adverse consequences.

share|improve this answer
I don't know if this would really count as a significant change to the page, though. IMHO it wouldn't be a big deal to remove this via JavaScript, particularly if you consider how many other things can change via JavaScript on the page for totally normal reasons.. like "show more comments" etc –  Jeff Atwood Dec 11 '10 at 1:01
@Jeff does that mean you'll consider doing it? –  Yahel Dec 11 '10 at 1:55
I agree to Joel Coehoorn. If the real users should not see the tag in the title, the crawler should not see it either. –  Tsuyoshi Ito Dec 12 '10 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .