如何防止bookmarklet自动重新加载页面

How to prevent the bookmarklet from auto reloading the page?

本文关键字:加载 新加载 bookmarklet 何防止      更新时间:2023-09-26

我正在试用这个bookmarklet

javascript:window.prompt("Title: " +document.title.length+ "/69'n'n" +document.title+ "'n'nCopy Title to clipboard: Ctrl+C, Enter",document.title);

我正试图将页面的标题与字符数一起显示,并找到一种将其复制到剪贴板的简单方法,但由于某种原因,在显示所需信息后,页面会重新加载

关于为什么会出现这种情况,有什么想法吗?

在bookmarklet 的末尾添加void(0)

javascript:window.prompt("标题:"+document.Title.length+"/69''n''n"+document.title+"''n''n将标题复制到剪贴板:Ctrl+C,Enter",document.title);void(0);