Paste any URL, toggle the optional behaviors, and copy a ready-made bookmarklet or DevTools one-liner that rewrites every external reference, converts linked styles to inline comments, and appends a scroll-to-text fragment anchored to the document title.
Uses the URL constructor to resolve relative links against the provided base, ensuring scripts, media, and hyperlinks all receive absolute paths.
When enabled, stylesheet links are replaced with HTML comments and their contents are injected via @import rules for a self-contained <style> block.
Optionally encodes the page title as a scroll-to-text fragment and prepends the original URL as an HTML comment before the <head>.
Adjust the base URL and behaviors, then copy the ready-made bookmarklet or DevTools one-liner.
The snippet resolves all relative links against this URL. If left blank, it defaults to https://example.com.
Inline styles
Convert stylesheet links to a single <style> block.
Scroll fragment
Append the encoded title to the URL as a scroll-to-text fragment.
Save this as a bookmark, edit the bookmark URL, and paste the snippet below. It runs the full rewrite pipeline whenever you activate it.
javascript:(function(){(function(){var u=decodeURIComponent("https%3A%2F%2Fexample.com");var d=document;if(d.readyState!=="complete"&&d.readyState!=="interactive"){setTimeout(arguments.callee,0);return}var h=d.head;var t=h.querySelector("title");var s=t?t.textContent.trim():"";var f=s?encodeURIComponent(s):"";var r=d.createComment(" Original URL: "+u+" ");h.parentNode.insertBefore(r,h);var b=d.body;var q=b.querySelectorAll('script[src],link[rel="stylesheet"][href],img[src],iframe[src],video[src],audio[src],source[src],embed[src],object[data],track[src],a[href^="http"]');var x=[];for(var i=0;i<q.length;i++){var e=q[i];if(e.nodeName==="SCRIPT"){var src=e.getAttribute("src");if(src){e.setAttribute("src",new URL(src,u).href);}}else if(e.nodeName==="LINK"&&e.getAttribute("rel")==="stylesheet"){var href=e.getAttribute("href");if(href){var c=d.createComment(" "+href+" ");e.parentNode.replaceChild(c,e);x.push(href);}}else{var attr=e.nodeName==="A"?"href":"src";var val=e.getAttribute(attr);if(val){e.setAttribute(attr,new URL(val,u).href);}}}());if(1==1){(function(){var d=document;var h=d.head;var q=d.querySelectorAll('link[rel="stylesheet"][href],style');var x=[];for(var i=0;i<q.length;i++){var e=q[i];if(e.nodeName==="LINK"){var href=e.getAttribute("href");if(href){x.push(href);e.remove();}}}if(x.length){var s=d.createElement("style");s.textContent=x.map(function(v){return "@import url("+v+");"}).join("
");h.appendChild(s);}})();}if(1==1){(function(){var d=document;var t=d.title;var s=t?t.textContent.trim():"";if(s){var u=decodeURIComponent("https%3A%2F%2Fexample.com");var f=encodeURIComponent(s);var l=d.location;l.replace(l.origin+l.pathname+"#:~:text="+f);}})();}})();Paste this into the DevTools Console on any page to run the rewrite immediately—no bookmarklet required.
(function(){(function(){var u=decodeURIComponent("https%3A%2F%2Fexample.com");var d=document;if(d.readyState!=="complete"&&d.readyState!=="interactive"){setTimeout(arguments.callee,0);return}var h=d.head;var t=h.querySelector("title");var s=t?t.textContent.trim():"";var f=s?encodeURIComponent(s):"";var r=d.createComment(" Original URL: "+u+" ");h.parentNode.insertBefore(r,h);var b=d.body;var q=b.querySelectorAll('script[src],link[rel="stylesheet"][href],img[src],iframe[src],video[src],audio[src],source[src],embed[src],object[data],track[src],a[href^="http"]');var x=[];for(var i=0;i<q.length;i++){var e=q[i];if(e.nodeName==="SCRIPT"){var src=e.getAttribute("src");if(src){e.setAttribute("src",new URL(src,u).href);}}else if(e.nodeName==="LINK"&&e.getAttribute("rel")==="stylesheet"){var href=e.getAttribute("href");if(href){var c=d.createComment(" "+href+" ");e.parentNode.replaceChild(c,e);x.push(href);}}else{var attr=e.nodeName==="A"?"href":"src";var val=e.getAttribute(attr);if(val){e.setAttribute(attr,new URL(val,u).href);}}}());if(1==1){(function(){var d=document;var h=d.head;var q=d.querySelectorAll('link[rel="stylesheet"][href],style');var x=[];for(var i=0;i<q.length;i++){var e=q[i];if(e.nodeName==="LINK"){var href=e.getAttribute("href");if(href){x.push(href);e.remove();}}}if(x.length){var s=d.createElement("style");s.textContent=x.map(function(v){return "@import url("+v+");"}).join("
");h.appendChild(s);}})();}if(1==1){(function(){var d=document;var t=d.title;var s=t?t.textContent.trim():"";if(s){var u=decodeURIComponent("https%3A%2F%2Fexample.com");var f=encodeURIComponent(s);var l=d.location;l.replace(l.origin+l.pathname+"#:~:text="+f);}})();}})();The script waits for the document to reach complete or interactive state before mutating the DOM, so it can safely run as a bookmarklet even if the page is still loading.
Stylesheet conversion collects every link[rel="stylesheet"], removes the nodes, and injects their URLs via @import rules into a single <style> element appended to <head>.
Scroll fragments are appended using the standard #:~:text= syntax, encoding the page title so browsers scroll directly to the first matching text region.
The original URL is preserved as an HTML comment directly before <head>, making it easy to audit the transformation later.