Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/91.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 实验bookmarklet;重定向正常吗?_Javascript_Html_Bookmarklet - Fatal编程技术网

Javascript 实验bookmarklet;重定向正常吗?

Javascript 实验bookmarklet;重定向正常吗?,javascript,html,bookmarklet,Javascript,Html,Bookmarklet,我正在努力提高制作书签的艺术水平。他们太迷人了!但是,在控制台中运行良好的代码不能作为bookmarklet使用,因为在执行之后,页面被重定向到代码的url。;有什么原因吗 代码: 尝试添加;void(0)位于bookmarklet链接的末尾 这里有一个很好的解释,说明为什么bookmarklet在中是必需的 此处还提供了有关bookmarklet返回值的更多信息。非常感谢!我喜欢链接。 <a href='javascript:try{document.getElementsByTagNa

我正在努力提高制作书签的艺术水平。他们太迷人了!但是,在控制台中运行良好的代码不能作为bookmarklet使用,因为在执行之后,页面被重定向到代码的url。;有什么原因吗

代码:

尝试添加
;void(0)
位于bookmarklet链接的末尾

这里有一个很好的解释,说明为什么bookmarklet在中是必需的


此处还提供了有关bookmarklet返回值的更多信息。

非常感谢!我喜欢链接。
<a href='javascript:try{document.getElementsByTagName("title")[0].innerHTML=prompt("new title")||"empty"}catch(e){}'>Change Title</a>
try {
    document.getElementsByTagName("title")[0].innerHTML = prompt("new title")||"empty" // in the event that there is no user input
} catch(e) {} // in the event that no title is found