Remove Reddit Recents Bookmarklet
A bookmarklet is a small piece of JavaScript code saved as a bookmark in your web browser. When clicked, it performs a specific action on the current web page, such as modifying content or extracting information. Bookmarklets are a handy way to extend browser functionality without installing full-fledged extensions.
Sometimes you might want to remove the recent subreddits list from the reddit sidebar. There is really no easy way to do this, but bookmarklet is one method and it is relatively easy and fast.
Javascript code for the Reddit bookmarklet
This is the all important javascript code where we manipulate your browsers local storage to remove "recent-subreddits-store". Copy this code to you clipboard, we are using it later.
javascript:(function() {
const keyToRemove = "recent-subreddits-store";
if (localStorage.getItem(keyToRemove)) {
localStorage.removeItem(keyToRemove);
alert(`The localStorage item "${keyToRemove}" has been removed.`);
} else {
alert(`No localStorage item named "${keyToRemove}" was found.`);
}
})();
Create the Bookmarklet in Your Browser
For Google Chrome and Mozilla Firefox:
1. Show the Bookmarks Bar:
- Chrome: Click the three dots in the upper-right corner, go to Bookmarks, and select Show bookmarks bar.
- Firefox: Click the hamburger menu, select Bookmarks, then Bookmarking Tools, and choose Add Bookmarks Menu to Toolbar.
2. Create a New Bookmark:
- Right-click on the bookmarks bar and select Add page... (Chrome) or New Bookmark... (Firefox).
3. Enter Bookmark Details:
- Name: Give your bookmarklet a name (e.g., "Remove Recents").
- URL/Location: Paste our JavaScript code here.
4. Save the Bookmark:
- Click Save to add the bookmarklet to your bookmarks bar.
5. Optional: If you don't want bookmarklet to show alert pop-up, you can remove both "alert" lines from the code.
Using the new bookmarklet
When you want to remove the reddit recents, go to the reddit front page reddit.com and click the bookmarklet. Pop-up alert will tell you "The localStorage item "recent-subreddits-store" has been removed." Klick "Ok" to close alert window, and refresh the reddit front page and your recents are gone!