Onion Link Opener

Open .onion links in Tor Browser

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Onion Link Opener
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Open .onion links in Tor Browser
// @author       Your Name
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to check if the link is a .onion link
    function isOnionLink(url) {
        return url.includes('.onion');
    }

    // Get all anchor tags on the page
    const links = document.getElementsByTagName('a');

    // Loop through the links and modify .onion links
    for (let link of links) {
        if (isOnionLink(link.href)) {
            // Change the link to open in Tor Browser
            link.href = 'tor:' + link.href;
        }
    }
})();