Web Compatibility Support • Re: Google's built-in AI is broken in PM: Something went wrong and the content wasn't generated.
Pale Moon forum - Forum index [Unofficial]
March 25, 2026
Below is the code I have used. It is just a work in progress, but it does restore the AI feature. I have had to update it a couple of times as Google have kept changing their script, altering some of the variable names, so this could happen again.
CODE:
// ==UserScript==// @name Google Script Rewriter// @namespace name// @include https://www.google.com/search*// @run-at document-start// @version 1// @grant none// ==/UserScript==(function() { var observer = new MutationObserver(mutations => { for (var m of mutations) { for (var node of m.addedNodes) { if (node.tagName === "SCRIPT" && node.textContent.includes("pipeThrough")) { // removes TextDecoderStream node.textContent = node.textContent.replace( ".pipeThrough(new TextDecoderStream)", "" ); //adds TextDecoder node.textContent = node.textContent.replace( "await a.B.read();", "await a.B.read();var dd = new TextDecoder().decode(d);d=dd;" ); //makes d a variable node.textContent = node.textContent.replace( "const {value:d", "var {value:d" ); //stop AI Overview section from being deleted node.textContent = node.textContent.replace( "for(let f=a.firstChild;f!==e;f=a.firstChild)a.removeChild(f)", "/*for(let f=a.firstChild;f!==e;f=a.firstChild)a.removeChild(f)*/" ); var clone = document.createElement("script"); clone.textContent = node.textContent; node.replaceWith(clone); } } } }); observer.observe(document.documentElement, { childList: true, subtree: true });})();
Discussion in the ATmosphere