HTML & Text Bookmarklets For FireFox

I’ve noticed that the bookmarklets for HTML and text don’t work in firefox. As I’m always tight on disc space I’ve come up with the following solution:

HTML for Firefox:


javascript:window.location='x-devonthink://createHTML?title='+encodeURIComponent(document.title)+'&location='+encodeURIComponent(window.location)+'&source='+encodeURIComponent("<html>\n"%20+%20document.documentElement.innerHTML%20+%20"</html>\n");

documentElement.innerHTML doesn’t capture the surrounding tags, so I’ve added them manually.

I’ve had less luck with text for Firefox:


javascript:window.location='x-devonthink://createText?title='+encodeURIComponent(document.title)+'&location='+encodeURIComponent(window.location)+'&source='+encodeURIComponent(document.getElementsByTagName("body")[0].textContent);

This does capture the body text but eliminates many line feeds. Any suggestions on that?

Be aware that my knowledge of DT is even less than the little I have of Javascript :slight_smile: . But the HTML bookmarklet works for me.

Regards,
Alex