Skip to content
anon.to
Sign in

Integrate anon.to

Send the outbound links on your site through anon.to, and the sites you link to stop learning which page sent the visitor.

The address

Put https://anon.to/? in front of any http or https address. Nothing is stored, and nothing needs to be shortened first.

Example
https://anon.to/?https://example.com/page

The destination is decoded once on the way through, so write any % before the # as %25. Both examples below do this.

JavaScript

Rewrite every link to another site once the page loads.

JavaScript
const prefix = 'https://anon.to/?';

document.querySelectorAll('a[href^="http"]').forEach((link) => {
    if (link.host !== location.host) {
        const [target, ...fragment] = link.href.split('#');

        link.href =
            prefix +
            target.replaceAll('%', '%25') +
            (fragment.length ? '#' + fragment.join('#') : '');
    }
});

PHP

Prefix each outbound link as you render it.

PHP
function anonymize(string $url): string
{
    [$target, $fragment] = array_pad(explode('#', $url, 2), 2, null);

    return 'https://anon.to/?' . str_replace('%', '%25', $target)
        . ($fragment === null ? '' : '#' . $fragment);
}

echo '<a href="' . htmlspecialchars(anonymize('https://example.com/page')) . '">Example</a>';