Reputation: 545985
I want to create a bookmarklet that sets the page to be editable, that is, to run this code:
javascript:document.body.contentEditable=true;
When I made a bookmark of that, I could see that the page becomes editable very briefly and then the whole thing is replaced with the word "true".
Upvotes: 2
Views: 895
Reputation: 6979
Bookmarklets have to evaluate to void for the browser stay on the same page. Just end it with a void(0)
:
javascript:document.body.contentEditable=true;void(0);
Upvotes: 2
Reputation: 17528
Some sites suggest that you use document.designMode=’on’
, but that doesn't work for me.
Regardless, your revised scripts works fine.
Upvotes: 0
Reputation: 545985
After a bit of random trial and error, I found that this worked:
javascript:(function() { document.body.contentEditable=true; })()
Are there any other ways?
Upvotes: 0