Ensures that all URLs to Lemmy instances always point to your main/home instance.
Description
Lemmy Universal Link Switcher, or LULs for short, scans all links on all websites, and if any link points to a Lemmy instance that is not your main/home instance, it rewrites the link so that it instead points to your main instance. Currently only works for community/user links.
Home Instance Setup
Simply visit the Lemmy instance you want to set as your home while the script is active. You will be asked if you want to set this instance to your home instance:
If you initially set your home instance wrong or just want to change it, no worries - simply go to your settings on your new home instance and press the button for it!
Features
Rewrite all links of communities or users on all websites everywhere to your new instance! The rewritten links will have an icon next to it, and hovering/touching the icon will show you the original link, allowing you to go there if you want to.
If you are already on a page that has a corresponding page on your home instance, a link will automatically be added to the page header.
Coming soon
Post & comment links. Those are a bit harder because the URL has to be requested from the instances.
Assuming you are logged in to the website, couldn't the website just check to see where you're logged in to? Seems like a cookie might be able to do that (if the user gave permission)?
The functionality in this script is indeed only possible as an addon or userscript. Browsers specifically spent a lot of work trying to make it impossible for one site to get any information about which other sites the user visited, and for good reason. Just imagine the phishing this would allow if it were possible.
That said, there could of course be an official lemmy browser addon/userscript for this functionality. But it definitely wouldn't be baked into the sites themselves.
Because idk if you noticed, but this script actually rewrites all links everywhere, so for example even if you get a result to some lemmy instance on duckduckgo, the link on duckduckgo itself will already point to your instance. Please tell me how that would be possible without an addon/userscipt :D
Cookies can only be read by the same domain (or subdomain). So a cookie set by lemmy.ml couldn't be read by lemmy.world, as their domains are different. This is called the "same-origin policy", and applies to all forms of local storage in browsers.