不用装任何插件,在浏览器收藏夹存一条 javascript: 开头的链接,点一下就在当前网页上执行。下面按用途分好类,需要哪个复制哪个。
这种写法叫 书签小脚本(Bookmarklet):把一段 JavaScript 代码存成书签,点书签时浏览器会在当前页面执行这段代码。它不依赖网站本身,所以任何网页都能用。
快捷键 Ctrl + Shift + B 显示/隐藏收藏栏。手机浏览器(夸克、UC、Chrome 移动版)在"书签管理"里也能新建网址书签,写法完全一样。
↑ 返回顶部javascript:window.scrollTo({top:0,behavior:'smooth'});
javascript:window.scrollTo(0,0);
javascript:window.scrollTo({top:document.body.scrollHeight,behavior:'smooth'});
javascript:window.scrollBy({top:window.innerHeight*0.9,behavior:'smooth'});
javascript:(function(){var d=document.documentElement;d.style.filter=d.style.filter?'':'invert(1) hue-rotate(180deg)';})();
javascript:(function(){var d=document.documentElement;d.style.filter=d.style.filter?'':'grayscale(1)';})();
javascript:(function(){var s=parseFloat(document.body.style.zoom||1);document.body.style.zoom=(s>=1.6?1:s+0.2);})();
javascript:(function(){var t=document.body.innerText;var w=document.createElement('div');w.style.cssText='max-width:888px;margin:0 auto;padding:20px 16px;font-size:17px;line-height:1.9;white-space:pre-wrap';w.textContent=t;document.body.innerHTML='';document.body.appendChild(w);})();
javascript:(function(){var t=document.body.innerText.slice(0,2000);speechSynthesis.cancel();speechSynthesis.speak(new SpeechSynthesisUtterance(t));})();
javascript:speechSynthesis.cancel();document.querySelectorAll('audio,video').forEach(function(a){try{a.pause();}catch(e){}});void 0;
javascript:document.oncopy=null;document.onselectstart=null;document.oncontextmenu=null;document.body.style.userSelect='auto';void 0;
javascript:(function(){var r=document.createRange();r.selectNodeContents(document.body);var s=window.getSelection();s.removeAllRanges();s.addRange(r);})();
javascript:(function(){var a=document.querySelectorAll('a[href]'),w=window.open('','_blank'),n=0;if(!w){alert('请在浏览器允许本页弹出窗口');return;}w.document.title='本页全部链接';var b=w.document.body;b.style.cssText='font:14px/1.9 sans-serif;padding:16px;word-break:break-all';for(var i=0;i
javascript:(function(){var t=document.title+'\n'+location.href;if(navigator.clipboard){navigator.clipboard.writeText(t).then(function(){alert('已复制:\n'+t);},function(){prompt('请手动复制:',t);});}else{prompt('请手动复制:',t);}})();
javascript:document.querySelectorAll('input[type=password]').forEach(function(i){i.type='text';});void 0;
javascript:(function(){var a=document.images,w=window.open('','_blank'),n=0;if(!w){alert('请允许本页弹出窗口');return;}var b=w.document.body;b.style.cssText='font:13px/1.9 monospace;padding:16px;word-break:break-all';for(var i=0;i
javascript:document.querySelectorAll('img,picture,svg').forEach(function(i){i.style.display='none';});void 0;
javascript:(function(){var s=document.createElement('style');s.textContent='*{animation:none!important;transition:none!important}';document.head.appendChild(s);})();
javascript:(function(){var d=document.documentElement;if(d.getAttribute('data-hddb')){d.removeAttribute('data-hddb');d.style.background='';d.style.color='';}else{d.setAttribute('data-hddb','1');d.style.background='#fff';d.style.color='#222';}})();
1. 前缀不能丢:必须以 javascript: 开头,整行一次性粘贴,不要带换行和多余空格,不要被浏览器自动补成 https://。
2. 部分网站会失效:启用 CSP 安全策略的网站会禁止执行书签脚本,点了没反应属正常现象,不是代码错。
3. 只能在网页里点:空白新标签页、浏览器设置页等非网页界面点了无效。
4. 别点陌生人的脚本:别人发来的 javascript: 链接可能是恶意代码,只存你自己确认过的。
5. 破坏页面就刷新:执行后排版乱、文字没了,按 F5 刷新即恢复原样,不会改坏网站。