0

Is it possible, within Firefox, to save pages containing text while keeping the basic formatting and positioning, but not saving any executable code (JavaScript)?

It doesn't need to be perfect, just a close approximation.

I need the text to be searchable, so taking a screenshot will not suffice.

Answers that apply to Windows are preferred.

What I've tried:

  1. Copy and paste into notepad.
    Result: Lost all text formatting and positioning (as expected).
  2. Copy and paste into OpenOffice, LibreOffice, and Wordpad.
    Result: Did not maintain sufficient text positioning. Specifically, left and right justified text all became left-justified.
  3. Save as text file from within Firefox.
    Result: Same as #1.
  4. Save as HTML-only file from within Firefox.
    Result: Same as #2.
  5. Save as HTML-complete file from within Firefox.
    Result: For whatever reason, Firefox reports a failure for many pages, probably due to how the pages are served via HTTPS.

My current workaround is a PITA. I download the HTML of the page and any CSS. Then I manually edit each HTML file to point to the local copy of the CSS files. Finally, I remove all JavaScript references. This takes a fair amount of time and effort, and results in a dependency on CSS files, instead of a single clean text or RTF file.

I have considered the Mozilla Archive Format extension, but I think it always saves all the JavaScript in the archive. I prefer a flat text or RTF (rich text) file with no dependencies and definitely no JavaScript.

4
  • I believe the usual process is to do manual work. Sorry. My guess is you won't see a very satisfying answer. However, how do you remove all JavaScript references? That ought to be fairly automate-able. For instance, replace <SCRIPT with <SCRdisabled (and /SCRIPT)... that would make the HTML technically invalid, but probably render just fine/acceptably.
    – TOOGAM
    Jun 10, 2016 at 21:47
  • @TOOGAM Yes, I make edits like that or just edit out all <SCRIPT> and </SCRIPT> tags. I don't like having to keep all the CSS files around, so I will sometimes copy and paste the important CSS styles into the HTML to apply them directly. It's rather time consuming. Cutting and pasting into a word processor comes so close, but losing the left and right-justification causes the loss of important positioning, especially for text transcriptions. Jun 10, 2016 at 22:00
  • Do ya hafta use Firefox? Can you use another web scraper, like cURL?
    – TOOGAM
    Jun 10, 2016 at 22:08
  • @TOOGAM Good question. I strongly prefer Firefox, but it doesn't have to use it. Just to clarify, I only have this need for occasional web pages (typically 1-5 per day), and I just need the text on the single page (I don't need to scrape an entire site or anything). The pages are typically served via HTTPS. I'm usually at a Windows box when I need to do this. Jun 10, 2016 at 23:02

0

You must log in to answer this question.

Browse other questions tagged .