Skip to content

Instantly share code, notes, and snippets.

@danielrotaermel
Last active November 21, 2024 18:32
Show Gist options
  • Save danielrotaermel/aa0eee5f100630860f83b2f6601dd07c to your computer and use it in GitHub Desktop.
Save danielrotaermel/aa0eee5f100630860f83b2f6601dd07c to your computer and use it in GitHub Desktop.
Never show the "For You" page or Reels on Instagram. Always redirect to the "Following" page. Tested with Userscript on Safari (iOS, MacOS) -> https://itunes.apple.com/us/app/userscripts/id1463298887
// ==UserScript==
// @name Instagram No ForYou !1!!11
// @description Never show the "For You" page or Reels on Instagram. Always redirect to the "Following" page.
// @match https://www.instagram.com/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function () {
'use strict';
const redirectToFollowing = () => {
const currentUrl = window.location.href;
// Check for unwanted URLs and redirect to the desired "Following" page
if (currentUrl === 'https://www.instagram.com/' ||
currentUrl === 'https://www.instagram.com' ||
currentUrl === 'https://www.instagram.com/?variant=home' ||
currentUrl.startsWith('https://www.instagram.com/reels/') ||
currentUrl.includes('?variant=for_you')) {
window.location.replace('https://www.instagram.com/?variant=following');
}
};
// Initial check for the URL on script load
redirectToFollowing();
// Observe URL changes (React uses client-side routing)
const observer = new MutationObserver(() => {
redirectToFollowing();
});
// Observe the <body> for changes in attributes (triggered by React's routing)
observer.observe(document.body, { childList: true, subtree: true });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment