It's happened to you. You're browsing cute cat pictures on Imgur, and someone adds one as a comment. You love it! You want to favorite it, and maybe upvote it! But opening the image in a new page just takes you to the file page. On Imgur's mobile clients, opening an image in the comments section lets you favorite it, but you can't do that on desktop.
Until now.
- Go to the "Code" section, and copy the line of code under "The Script"
- Make a new bookmark
- Where it asks for the URL, enter the line of code you copied
- Give it whatever name you want, I have mine as "Imgur Full Page" but it's up to you!
- Go to any Imgur file page (like this one!)
- Click the link in your address bar
- Admire Pusheen
All Internet browsers (desktop/mobile) should be able to use this without any issues.
The Script:
javascript:void%20function()%7B%20window.location=%22https://imgur.com/%22+window.location.href.split(%22imgur.com/%22)%5B1%5D.split(%22.%22)%5B0%5D;%20%7D()
Expanded:
void function(){
window.location=`https://imgur.com/${window.location.href.split("imgur.com/")[1].split(".")[0]}`;
}()
Expanded More:
void function(){
const currentPage = window.location.href;
const currentFileName = currentPage.split("imgur.com/")[1];
const imgurID = currentFileName.split(".")[0];
window.location = `https://imgur.com/${imgurID}`;
}()
- Grabs the full address of the current page (what's in the address bar)
- Splits everything before
imgur.com/
into one element of an array, and everything that follows into another element of the same array. - In the same string as above, we grab everything before the period (the file extension, regardless of what it is). This is now the unique ID of the image on Imgur.
- Redirect the user to the full page of the image, based on the ID from 3.
"https://i.imgur.com/BVJ4E9t.gif"
["https://i.imgur.com/", "BVJ4E9t.gif"]
we only care aboutBVJ4E9t.gif
["BVJ4E9t", ".gif"]
window.location = "https://imgur.com/BVJ4E9t"
- User is redirected to https://imgur.com/BVJ4E9t