An alternative of copy paste bookmarklet

16 Aug 2010

In the previous month, I wrote a post about copy paste bookmarklet. The bookmarklet make use of the prompt() function as shown in textbox below:

the bookmarklet simply loads all text from currently opened web page in an input box. Sometimes the use of the bookmarklet causes error where browser points to previously created prompt.

After several trial and error, I wrote a new bookmarklet which make use of document.write() function. Still pretty simple, just as follows:

var t=document.body.innerText;
save all text from web page in variable t

document.write("<textarea>"+t+"</textarea>");
write an HTML page, with t inside textarea tag. Thus, all text in variable t, which comes from web page, will be shown in textbox.

document.close();
closing.

This new bookmarklet doesn’t cause error as the old one.

Hope it’s useful.


TAGS bookmarklet opera mini mobile copy english paste textarea


-

Author

Follow Me