Proxy Redirect

Redirect to privacy respecting proxy frontends

Alt: v25.11.08 - 08.11.2025 - Improve interface.
Neu: v25.11.17 - 17.11.2025 - Fixed functionality with servers that require, so called, "trusted HTML assignment".

  • --- /tmp/diffy20251122-3623223-vrs4p8 2025-11-22 13:28:28.726998352 +0000
  • +++ /tmp/diffy20251122-3623223-wmywjf 2025-11-22 13:28:28.726998352 +0000
  • @@ -12,7 +12,7 @@
  • // @namespace i2p.schimon.proxy-redirect
  • // @description Redirect to privacy respecting proxy frontends
  • // @run-at document-start
  • -// @version 25.11.08
  • +// @version 25.11.17
  • // @grant GM.getValue
  • // @grant GM.registerMenuCommand
  • // @grant GM.setValue
  • @@ -2194,7 +2194,23 @@
  • // /questions/6464592/how-to-align-entire-html-body-to-the-center
  • const loadPage = '<html xmlns="http://www.w3.org/1999/xhtml" style="display:table;margin:auto;"><head><link type="image/svg+xml" rel="shortcut icon" href="data:image/svg+xml,&lt;svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22&gt; &lt;text y=%22.9em%22 font-size=%2290%22&gt;&#x1F978;&lt;/text&gt; &lt;/svg&gt;"/><title>Proxy Redirect</title></head><body style="padding:1em;display:table-cell;height:100%;background-color:#f1f1f1;font-family:system-ui;cursor:default;user-select:none;max-height:100%;max-width:100%;"><dl><dt><h1>&#x1F978; Proxy Redirect</h1></dt><dd><h2>The request is being redirected to a privacy proxy frontend.</h2><div id="message"><h3 style="color:#0000ff;">Redirecting...</h3></div><div>Made for <a href="https://falkon.org">Falkon</a></div></dd></dl></body></html>';
  • const domParser = new DOMParser();
  • - const newDocument = domParser.parseFromString(loadPage, 'text/html');
  • + let newDocument;
  • + try {
  • + newDocument = domParser.parseFromString(loadPage, 'text/html');
  • + } catch (e) {
  • + console.warn(e);
  • + // TODO Recognize TrustedHTML, as or similarly to "securitypolicyviolation".
  • + if (e.toString().includes("TypeError") && e.toString().includes("TrustedHTML")) {
  • + // Thank you. hacker09.
  • + // https://greasyfork.org/en/discussions/development/220765#comment-469969
  • + if (window.trustedTypes && window.trustedTypes.createPolicy) {
  • + window.trustedTypes.createPolicy("default", {
  • + createHTML: (string, sink) => string
  • + });
  • + }
  • + newDocument = domParser.parseFromString(loadPage, 'text/html');
  • + }
  • + }
  • +
  • //newDocument.querySelector('#icon-tc').onclick = () => {disable()}; // FIXME
  • //newDocument.querySelector('#icon-tc').addEventListener("click", disable, false);
  • const insertDocument = document.importNode(newDocument.documentElement, true);