[UserScript] Steam Store - Removed App/Sub Redirect To SteamDB

Introduction

Hi, ever wanted to go to the store page of a steam game, only to find out it redirects to the main steam store page? This can be quite annoying at times, especially for a trader who quite often encounter such removed games. This userscript checks each link to a steam store item if it redirects you the main page of the steam store upon clicking. If it does, it will instead open the item in SteamDB. I usually had to do this manually if I wanted to check out games removed from the Steam Store. Now, with this userscript, this happens automatically. It is not really an userscript for SteamGifts, but it is a handy tool for trader who deal with removed games a lot. I hope you enjoy it!

Features

  • Automatically check steam store links, when clicking on them.
  • Redirects you to SteamDB instead of the Steam Store, if the link is of a removed or region-locked item.

Download

Instructions

  1. Download and install Tampermonkey for your browser (For FireFox users, I recommened GreaseMonkey)
  2. Download the userscript above
  3. Hit install when asked
  4. Enjoy!

Credits

Examples

The following games/bundles are no longer available in the steam store:

8 years ago*

Comment has been collapsed.

Deleted

This comment was deleted 8 years ago.

8 years ago
Permalink

Comment has been collapsed.

Thanks for the tip. added examples.

8 years ago
Permalink

Comment has been collapsed.

Why is the script set to function on ALL domains, rather than targeting store.steampowered.com and steamcommunity.com?

8 years ago
Permalink

Comment has been collapsed.

Doesn't that make sense? If someone (e.g. a trader) somewhere (e.g. steamtrades) links to a game removed on steam, this script will make sure when you click on it you land on SteamDB instead of http://store.steampowered.com

8 years ago
Permalink

Comment has been collapsed.

But instead this script scans every single URL I ever click, even totally unrelated to Steam? No thanks.

8 years ago
Permalink

Comment has been collapsed.

No, only links to store.steampowered.com. Check the source.

8 years ago
Permalink

Comment has been collapsed.

When I install it, the warning states "*" unqualified, only excluding "file:///". If you're using a bare wildcard, then yes, ALL links.

8 years ago
Permalink

Comment has been collapsed.

Oh, I thought u meant URL's on the web pages.
But yes, it runs on every website... as it should!
It makes no sense to restrict it to only steamcommunity/steampowered.
What if I link a removed steam game here?
Or anywhere for that matter.
If you don't like that (I don't see a reason why not), you don't have to install this script.
Thanks

8 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 4 years ago.

8 years ago
Permalink

Comment has been collapsed.

I know all this... But this is not what I want to do! It makes not sense to restrict this userscript on to the steam web pages (they probably won't contain any removed apps). It should work for every site you visit that happens to have links to steam on the page.

8 years ago
Permalink

Comment has been collapsed.

You don't have to restrict it to the steam webpages, you can restrict it to SG and ST and it'll work well enough.

8 years ago
Permalink

Comment has been collapsed.

or run only on steams main page and check referrer there, since that's where removed apps/subs redirect to.

8 years ago
Permalink

Comment has been collapsed.

That could work, just check the document.referrer when going to the steam front page.

8 years ago
Permalink

Comment has been collapsed.

Yeah... that was my original approach to tackling this, but document.referrer doesn't state such redirects sadly.

8 years ago
Permalink

Comment has been collapsed.

I disagree, it should work anywhere. What about google for example?

8 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 4 years ago.

8 years ago
Permalink

Comment has been collapsed.

Thank you. This is exactly what I meant, but I was posting when half asleep and couldn't explain better than the wildcard :P

8 years ago
Permalink

Comment has been collapsed.

Not working for me. Firefox 50.0.2.

8 years ago
Permalink

Comment has been collapsed.

Do you use Tampermonkey?

8 years ago
Permalink

Comment has been collapsed.

Initially it did not work for me (Chrome 54.0.2840.99) until I loaded this page in a new window.

I can see how this script can be useful, but I'm not sure I'd like to add a delay every time I click a Steam store link. When I find a removed game it's typically easy to just google for the game name and add steamdb as a keyword. If there was a way for the script to catch the Steam redirect to the homepage and only then redirect to steamdb it would have more convenient.

8 years ago
Permalink

Comment has been collapsed.

I had the same thought and just looked into this.It is not possible with userscripts, since the redirect is on HTTP level and scripts get evaluated on the document. It should be possible for a dedicated browser addon though.

@Royalgamer06: I love the idea! Some suggestions for improvement:

  • I am not a fan of scripts that enable themselves everywhere, especially when I only need itt on one page (SG). It slows down every request. You should consider limiting your script to steamgifts.
  • You should use "HEAD" instead of "GET" for you request, to avoid loading the whole document unnecessarily.
8 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 4 years ago.

8 years ago
Permalink

Comment has been collapsed.

HEAD will still return the response header of the final page (=200), but at least it won't fetch the whole document.

8 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 4 years ago.

8 years ago
Permalink

Comment has been collapsed.

Yes.

EDIT: Working now. Not sure what happened there.

8 years ago*
Permalink

Comment has been collapsed.

Seems finalUrl function doesn't work properly in FireFox... and I can't many any alternatives work. :/

8 years ago
Permalink

Comment has been collapsed.

can you do it somehow without it being a popup?

8 years ago
Permalink

Comment has been collapsed.

Updated script. Try now.

8 years ago
Permalink

Comment has been collapsed.

now it's much better

8 years ago
Permalink

Comment has been collapsed.

I updated the script again. I can't use the previous method that fixed your problem anymore.
Tell me if you have the popup problem again. I hope not.

8 years ago
Permalink

Comment has been collapsed.

no problem here but i liked background tab better than new active one

8 years ago
Permalink

Comment has been collapsed.

Great! What do you mean with background tab?

8 years ago
Permalink

Comment has been collapsed.

in previous version it opened and loaded in tab next to active one without loading/reloading active, now it just opens a new tab and makes it active

8 years ago
Permalink

Comment has been collapsed.

Still not 100% sure what you mean, but try to replace "_self" with "_blank" in the script and see if you like he changes.

8 years ago
Permalink

Comment has been collapsed.

doesn't work.

8 years ago
Permalink

Comment has been collapsed.

same but thanks.

8 years ago
Permalink

Comment has been collapsed.

works now

8 years ago
Permalink

Comment has been collapsed.

not for me , i get still too store main page (Chrome Explorer)

8 years ago
Permalink

Comment has been collapsed.

Google Chrome? Update and try again.

8 years ago
Permalink

Comment has been collapsed.

still dont work

updated to version ( 55.0.2883.87 m (64-bit)

8 years ago
Permalink

Comment has been collapsed.

Are you using Tampermonkey?

8 years ago
Permalink

Comment has been collapsed.

Yes

8 years ago
Permalink

Comment has been collapsed.

I don't know then. Try disabling other scripts/extensions.

8 years ago
Permalink

Comment has been collapsed.

disabled all , but still not work

thanks anyways good luck with that. addon / script

8 years ago
Permalink

Comment has been collapsed.

According to his profile, BcompleXx is German, just like i am. Also i use Tempermonkey and disabled all other scripts and enhanced steam addon to test.

On region locked games, like wolfenstein, i see the usual "product is not available in your region" for a second before i get redirected to steamdb. On removed games (i tried a lot of those you listed in the first post) i get redirected to http://store.steampowered.com/ immediately and without an error in the console.

Edit: i don't know if this helps, but i found out it actually does redirect, but it seems to have problems with lots of tabs in multiple windows. I open a link in a new tab in one window and it works, other links work too, trying to copy & paste said links or "open in new window" will result in nothing. I tried logging finalURL to console ( console.log(response.finalUrl); at the end of the onload function ) but it will not give any output. The region locked ones seem to be working at all of the time though.

8 years ago*
Permalink

Comment has been collapsed.

add console.log(response.finalUrl) in the onload function and check what it logs.
It may be the same issue many firefox users are having.

8 years ago
Permalink

Comment has been collapsed.

Does this support regional links (not available in region titles, Steam bundles removed from certain regions during sales)?

8 years ago
Permalink

Comment has been collapsed.

It should support any store.steampowered.com/app/xxx and store.steampowered.com/sub/xxx link that redirects to store.steampowered.com for you.

8 years ago
Permalink

Comment has been collapsed.

I added support for region-locked pages. Update and try.

8 years ago
Permalink

Comment has been collapsed.

Can you add function so it also redirects when the game's region locked?

8 years ago
Permalink

Comment has been collapsed.

Have you tried it to see if it doesn't already do it?

8 years ago
Permalink

Comment has been collapsed.

Can you give me an example?

8 years ago
Permalink

Comment has been collapsed.

8 years ago
Permalink

Comment has been collapsed.

I added support for region-locked pages. Update and try.

8 years ago
Permalink

Comment has been collapsed.

I went ahead and played a little around with your code, trying to eliminate the need to wait for an ajax response every time.
What my code does different, is that it always opens the target url in a new tab first.
Then it fetches the page again in the xhr and does the redirect check. If it was redirecet, the previously opened window is closed and a new tab is opened with the steamdb link.

This way, if it is a valid url, everything just works. If not, you'll see a tab open and close in <1s before you get sent to the right page.

document.querySelectorAll("a[href*='://store.steampowered.com/app/'], a[href*='://store.steampowered.com/sub/']").forEach(function(linkElem) {
    linkElem.onclick = function() {
        var w = GM_openInTab(linkElem.href);
        GM_xmlhttpRequest({
            method: "HEAD",
            url: linkElem.href,
            onload: function(response) {
                if (/^https?:\/\/store\.steampowered.com\/?$/.test(response.finalUrl)) {
                    w.close();
                    GM_openInTab(linkElem.href.replace("store.steampowered.com", "steamdb.info"));
                }
            }
        });
        return false;
    };
});
8 years ago*
Permalink

Comment has been collapsed.

Yeah, I had a similar idea. Instead of closing and reopening tabs, I made the tab change location once detected. Check out my new update :)

8 years ago
Permalink

Comment has been collapsed.

Nice! I went with close and reopen because the object returned by GM_openInTab does not let you change it's location. Clever to use unsafeWindow instead ;-)

8 years ago
Permalink

Comment has been collapsed.

Firefox, script unfortunately not working.

8 years ago
Permalink

Comment has been collapsed.

Mention the FF version as well.

8 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 4 years ago.

8 years ago
Permalink

Comment has been collapsed.

That doesn't seem to fix it unfortunately.
The problem is that FireFox doesn't detect the real finalUrl... therefore it doesn't work.

8 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 4 years ago.

8 years ago
Permalink

Comment has been collapsed.

I debugged a lot on firefox, but I could never get the real final URL from firefox. Meaning that for example console.log(response.finalUrl) in firefox would output http://store.steampowered.com/app/273580 instead of http://store.steampowered.com.

8 years ago
Permalink

Comment has been collapsed.

Strange, I tested your script in in FF+GM and it worked like a charm.
But if you are getting the app url as final url, the status should be 302, shouldn't it?

8 years ago
Permalink

Comment has been collapsed.

Not sure

8 years ago
Permalink

Comment has been collapsed.

It works on Firefox 52. But not older version like Firefox 39.

I modify some code that compatible with Firefox 39 without Jquery.

var eles = document.querySelectorAll("a[href*='://store.steampowered.com/app/'], a[href*='://store.steampowered.com/sub/']");
for (var i = 0; i < eles.length; i++)
{
    eles[i].addEventListener("click", function(ev)
    {
        ev.preventDefault();

        var linkElem = ev.target;
        var w = linkElem.target ? unsafeWindow.open(linkElem.href, linkElem.target) : unsafeWindow.open(linkElem.href, "_self");
        GM_xmlhttpRequest({
            method: "HEAD",
            url: linkElem.href,
            onload: function(response) {
                if (/^https?:\/\/store\.steampowered.com\/?$/.test(response.finalUrl)) {
                    w.location.href = linkElem.href.replace("store.steampowered.com", "steamdb.info");
                }
            }
        });
    });
}

PS: document.querySelectorAll("...").forEach can only use in FF50+ https://developer.mozilla.org/en/docs/Web/API/NodeList#Browser_compatibility

8 years ago*
Permalink

Comment has been collapsed.

Work with left click only.

8 years ago
Permalink

Comment has been collapsed.

Thanks, updated.

8 years ago
Permalink

Comment has been collapsed.

Thanks for supporting middle click.

I have a suggestion.
Please restore attribute href after click.
It's important to me to identify each links are visited.

7 years ago
Permalink

Comment has been collapsed.

Okay, updated.
I might have had a reason why I didn't do that, but I don't remember why.
So, please test thoroughly if you can find any bugs.
Thanks

7 years ago
Permalink

Comment has been collapsed.

Middle click open 2 tabs.

I test this work.

setTimeout(function(linkElem, href)
{
    linkElem.setAttribute("href", href);
}, 10, linkElem, href);
7 years ago
Permalink

Comment has been collapsed.

I guess that works too. Thanks for testing.

7 years ago
Permalink

Comment has been collapsed.

And I was wondering, why left mouse button stopped to work correctly... No thanks, some redirects don't worth broken browser behavior.

7 years ago
Permalink

Comment has been collapsed.

Possible to don't removeAttribute("href") when right click?

7 years ago
Permalink

Comment has been collapsed.

Okay. Updated :)

7 years ago
Permalink

Comment has been collapsed.

New bug, middle click in Firefox open 2 tabs.

7 years ago
Permalink

Comment has been collapsed.

That's why I had this workaround... It works on chrome now though.

7 years ago
Permalink

Comment has been collapsed.

Check new version.

7 years ago
Permalink

Comment has been collapsed.

Still double.
I think you must remove href and restore as ver 1.2 to prevent middle click default behavior in FF.

I edit your code in ver 1.2 to preserve href when right click.

linkElem.onmousedown = function(ev) {
    if (ev.button) {
        if (ev.button == 1) {
            ev.preventDefault();
            linkElem.removeAttribute("href");
        }
    }
};
7 years ago
Permalink

Comment has been collapsed.

No, I removed it to prevent double tabs.

7 years ago
Permalink

Comment has been collapsed.

Ver 1.4 still has double tab when middle click in Firefox.
So I still use your 1.2 and edit as above.

7 years ago
Permalink

Comment has been collapsed.

Weird... Everything works fine here on firefix.

7 years ago
Permalink

Comment has been collapsed.

I have this problem on Firefox 54 and 39 on ver 1.4
Double tabs when middle click, control+click and normal left click.

Ver 1.2 run normally.

7 years ago
Permalink

Comment has been collapsed.

-

7 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 1 year ago.

5 years ago
Permalink

Comment has been collapsed.

Works for me

5 years ago
Permalink

Comment has been collapsed.

I just found it when it's broken :(

5 years ago
Permalink

Comment has been collapsed.

May I suggest you a replacement then?

5 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 1 year ago.

5 years ago
Permalink

Comment has been collapsed.

Works for me

5 years ago
Permalink

Comment has been collapsed.

Doesn't work any more.

3 years ago
Permalink

Comment has been collapsed.

It does actually still work

3 years ago
Permalink

Comment has been collapsed.

Sign in through Steam to add a comment.