javascript - Experimenting with bookmarklet; redirecting normal? -
i'm trying become better in art of making bookmarklets. they're fascinating! however, code works in console doesn't work bookmarklet, as, after execution, page redirected url of code.; there reason?
code:
<a href='javascript:try{document.getelementsbytagname("title")[0].innerhtml=prompt("new title")||"empty"}catch(e){}'>change title</a>
javascript:
try { document.getelementsbytagname("title")[0].innerhtml = prompt("new title")||"empty" // in event there no user input } catch(e) {} // in event no title found
try appending ;void(0)
@ end of bookmarklet link.
there's explanation of why that's necessary bookmarklets in this other answer.
more info on bookmarklet return values provided here, http://subsimple.com/bookmarklets/rules.php#returnvalues .
Comments
Post a Comment