Setting it as
javascript:<code>;void(0);
can make it useful as a boomarklet :)Setting it as
javascript:<code>;void(0);
can make it useful as a boomarklet :)(For anyone who doesn’t know about the meaning of void in JavaScript: it’s a unary operator that ignores its operand and produces undefined. What is commonly spelled `void(0)` is briefer as `void 0`. Why don’t people just write `undefined`? For some, because it’s shorter, but mostly for historical reasons: `undefined` is a global property rather than a keyword, and until ES5 (a decade ago), that global property was writeable, so you couldn’t rely on its value because people might do crazy things. And if you’re wondering why a javascript: URL needs to produce exactly the value undefined: if it doesn’t, the browser will convert the value to a string and replace the page with that, loaded as HTML, as demonstrated by this (paste it in your address bar, you can’t click on data: URLs directly for security reasons):
data:text/html;charset=utf-8,<a href="javascript:'<h1>Here is a page.'">α</a> <a href="javascript:({toString(){return '<h1>See, stringification!'}})">β</a> <a href="javascript:/*even*/null/*gets stringified*/">γ</a> <a href="javascript:undefined">δ</a>
.)I retract the first paragraph of my earlier comment with an apology.