我正在制作的小书签以某种方式执行 document.write 尽管它不在代码中
Bookmarklet i'm making is somehow performing document.write though its not in the code
我正在尝试编写一个小书签来切换使页面上的任何文本都可编辑的功能,但是当我执行它时,它似乎在执行一些类似于 document.write('off')
的操作。这是 code/bookmarklet:
javascript: if (document.body.contentEditable == "true") {
document.body.contentEditable = "true";
document.designMode = 'on';
} else {
document.body.contentEditable = "false";
document.designMode = "off"
}
试试 IIFE
javascript:(function(){if (document.body.contentEditable == "true") {
document.body.contentEditable = "true";
document.designMode = 'on';
} else {
document.body.contentEditable = "false";
document.designMode = "off"
}})()
我正在尝试编写一个小书签来切换使页面上的任何文本都可编辑的功能,但是当我执行它时,它似乎在执行一些类似于 document.write('off')
的操作。这是 code/bookmarklet:
javascript: if (document.body.contentEditable == "true") {
document.body.contentEditable = "true";
document.designMode = 'on';
} else {
document.body.contentEditable = "false";
document.designMode = "off"
}
试试 IIFE
javascript:(function(){if (document.body.contentEditable == "true") {
document.body.contentEditable = "true";
document.designMode = 'on';
} else {
document.body.contentEditable = "false";
document.designMode = "off"
}})()