jacksparrow007
jacksparrow007

Reputation: 1328

browser plugin to save selected text to local file

I want to build a browser plugin which will save the user selected block of text in a text file on the users local system(or allow the user to download the text file). Is this possible? Can javascript write to files on the clients local system?

If yes, are there any open source plugins that do this?

Upvotes: 0

Views: 1382

Answers (1)

bobbyrne01
bobbyrne01

Reputation: 6745

I developed an open source extension for this purpose recently, you can download it from:
https://addons.mozilla.org/en-US/firefox/addon/save-text-to-file/

Save Text to File

Saves highlighted text to a file in a directory (defaulting to the user's home directory)
After highlighting some text, right-click and select "Save Text to File"
File names have the format userPreference--<todaysdate>-<timestamp>.txt

Features:

  • Options to include/exclude time/date stamps in saved file name
  • Option to show preferences dialog when "Save Text to File" is clicked
  • Text is encoded in UTF-8 (Unicode) so all international characters can be stored correctly
  • Determines context clicked and only shows "Save to File" menuitem if context is text
  • Ability to either append text to existing file or create a new file

Compatibility

  • Firefox 2.0 - 17.*
  • SeaMonkey 2.0 - 2.13.*

Localization:

English (en-US), Chinese (zh-CN), French (fr), German (de), Japanese (ja), Polish (pl) and Spanish (es-ES)

Upvotes: 2

Related Questions