搜尋 Mozilla 技術支援網站

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How to effectively save a page after having converted it using reader-viewer?

  • 13 回覆
  • 1 有這個問題
  • 96 次檢視
  • 最近回覆由 jscher2000

more options

I used Firefox 61.0.1 on Linux Mint.

Firefox's reader viewer removes clutter from web pages. It works fine online, but save pages come out blank offline. if you open with a text a editor, you can see they contain the text.

Is there a way to fix this?

Screenshots:

Saved original page displayed in browser; Saved reader-viewer page displayed in browser; The files with their size.

Truncated content of the saved html page with reader-viewer:

<meta content="default-src chrome:; img-src *; media-src *" http-equiv="Content-Security-Policy"> <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <meta content="width=device-width; user-scalable=0" name="viewport"> <link href="List%20of%20compositions%20by%20Johann%20Sebastian%20Bach_files/aboutReader.css" rel="stylesheet" type="text/css"> <script src="List%20of%20compositions%20by%20Johann%20Sebastian%20Bach_files/aboutReader.js" type="text/javascript"></script> <link href="List%20of%20compositions%20by%20Johann%20Sebastian%20Bach_files/narrate.css" rel="stylesheet"><title>List of compositions by Johann Sebastian Bach</title><link href="https://en.wikipedia.org/static/favicon/wikipedia.ico" rel="shortcut icon">

en.wikipedia.org

List of compositions by Johann Sebastian Bach


1. Cantatas (see also: List of Bach cantatas, Church cantata (Bach) and List of secular cantatas by Johann Sebastian Bach) Up ↑ 1 1. 1725-03-25 Cantata Wie schön leuchtet der Morgenstern (Annunciation) F major stbSATB 2Hn 2Odc 2Vl Str Bc 1: 1 I/28.2: 3 0001 2 1. 1724-06-18 Cantata Ach Gott, vom Himmel sieh darein (Trinity II) G minor atbSATB 4Tbn 2Ob Str Bc 1: 53 I/16: 81 0002 3 1. 1725-01-14 Cantata Ach Gott, wie manches Herzeleid (Epiphany II) A major satbSATB Hn Tbn 2Oba Str Bc 1: 73 I/5: 189 0003 4.2 1. 1724-04-09 Cantata Christ lag in Todes Banden (Easter) E minor satbSATB Cnt 3Tbn Str Bc 1: 95 I/9: 1 text by Luther; after BWV 4.1 0004 4.1 1. 1707-04-24 Cantata Christ lag in Todes Banden (Easter; early version, lost) satbSATB 2Vl 2Va Bc I/9 text by Luther; → BWV 4.2 0005 5 1. 1724-10-15 Cantata Wo soll ich fliehen hin (Trinity XIX) G minor satbSATB Tdt 2Ob Str Bc 1: 125 I/24: 133 0006 6 1. 1725-04-02 Cantata Bleib bei uns, denn es will Abend werden (Easter 2) C minor satbSATB 2Ob Odc Str Vc Bc 1: 151 I/10: 43 → BWV 649 0007 7 1. 1724-06-24 Cantata Christ unser Herr zum Jordan kam (24 June: feast of John the Baptist) E minor atbSATB 2Oba 2Vl Str Bc 1: 177 I/29: 25 0008 8.1 1. 1724-09-24 Cantata Liebster Gott, wenn werd ich sterben? (Trinity XVI; 1st version) E major satbSATB Hn Fl Fl 2Oba Str Bc 1: 211 I/23: 105 → BWV 8.2 0009 8.2 1. 1747-09-17 Cantata Liebster Gott, wenn werd ich sterben? (Trinity XVI; 2nd version) D major satbSATB Fl 2Oba Tai 2Vl Str Bc I/23: 163 after BWV 8.1 0010 9 1. 1732-07-20 Cantata Es ist das Heil uns kommen her (Trinity VI) E major satbSATB Fl Oba Str Bc 1: 243 I/17.2: 83 → BWV 648 0011 10 1. 1724-07-02 Cantata Meine Seel erhebt den Herren a.k.a. German Magnificat (Visitation) G minor satbSATB Tr 2Ob Str Bc 1: 275 I/28.2: 131 0012 12 1. 1714-04-22

1724-04-30

Cantata Weinen, Klagen, Sorgen, Zagen (Jubilate; two versions) F Dorian

G minor

atbSATB Tr Ob 2Vl 2Va Bas Bc 2: 59

附加的畫面擷圖

所有回覆 (13)

more options

Hmm, if you use the "Web page, Complete" format, it should work. (The "Web page, HTML Only" format does NOT work.)

If you use

(menu bar) View > Page Style > No Style

do you get a giant dump of all the text in the page?

If that works, it seems to indicate some problem laying it out using the standard reader view style sheet.

more options

jscher2000 said

Hmm, if you use the "Web page, Complete" format, it should work. (The "Web page, HTML Only" format does NOT work.)

Thanks, but not it does not solve the problem.

I made sure the Complete option was selected (it is by default in my case), and when you clike the saved html, it opens a blank page. Not with the original html, only after converting the page using reader-viewer.

The file sizes are shown in the third attachment.

more options

Yes, we're on the same page about the way you need to save and the way you did save.

Did you try turning off style rules to see what happens?

Can you think of any add-ons that could be modifying the page?

more options

jscher2000 said

Yes, we're on the same page about the way you need to save and the way you did save.

Sorry, we are not on the same page. If I knew how to do what I want, I would not be posting about it.

more options

Here's what I meant: You saved the file the same way I did, mine shows the text, yours does not. This part is all settled.

Can you please focus on my second question now?

more options

jscher2000 said

Here's what I meant: You saved the file the same way I did, mine shows the text, yours does not. This part is all settled.

OK, sorry

Can you please focus on my second question now?

I don't understand it. Obviously, Reader is modifying the page, which is as intended, online. Why is the page saved after toggling to the Reader blank? That's my question.

I have only 3 add-ons and the two others are neither running nor likely to interfere.

more options

Does the problem not replicate on other machines?

https://en.wikipedia.org/wiki/List_of_compositions_by_Johann_Sebastian_Bach

more options

erw1 said

Does the problem not replicate on other machines? https://en.wikipedia.org/wiki/List_of_compositions_by_Johann_Sebastian_Bach

This was the result of my test (screenshot attached). I already updated this morning, but I don't know if that makes a difference.

more options

Thanks.

Here are the Reader files, as saved on my machine:

https://expirebox.com/download/b29dfaf8f6fd0c238f4425f6da33ef7f.html

Would someone mind checking how they work on their machine?

more options

Sorry, Firefox won't let me download the file, says it contains a virus. That can happen if you use a file hosting site with a bad reputation, even if the file itself is clean.

But you already confirmed the text is in the file. How does it display in your other browser(s)?

more options

I'll try on Windows another day. Meanwhile here's the same file uploaded to Google Drive:

https://drive.google.com/open?id=139sU6riuYqu83rBlB44XlCVGXUWHZ4g4

more options

PS: I don't have another browser on Linux.

more options

Thanks for the file. There is a key difference on the title div and main content div:

Mine:

<div class="header reader-header reader-show-element" dir="ltr">

<div class="moz-reader-content line-height3 reader-show-element" dir="ltr">

Yours:

<div class="header reader-header" style="display: block;" dir="ltr">

<div class="moz-reader-content line-height4" style="display: block;" dir="ltr">

I don't know what is causing that difference, but it might be related to my using Firefox 62.

When viewed in the browser, the display: block; gets stripped from your tags, returning the content to a hidden state.

That seems to be caused by a Content Security Policy (CSP) restriction in the page that is inactive when you view the page directly from the server, but takes over in a saved file (this is the second line of the file):

<meta http-equiv="Content-Security-Policy" content="default-src chrome:; img-src *; media-src *">

While you can defeat this by completely disabling CSP in Firefox, that's not a safe way to browse.

As a crude "hack-around," you could try this snippet of code to restore the stripped style rule. To apply it, open the Web Console using either:

  • "3-bar" menu button > Web Developer > Web Console
  • (menu bar) Tools > Web Developer > Web Console
  • (Linux) Ctrl+Shift+k

Then paste this line of script in the blank at the bottom and press Enter/Return to execute it. The first time, Firefox should warn you that it's dangerous to run code from strangers and make you acknowledge that before you can run it.

document.querySelector('div.header.reader-header').style.display = 'block'; document.querySelector('div.moz-reader-content').style.display = 'block';

If you have a lot of these pages, a user script or bookmarklet would be much more convenient.

Or a bulk text-file editor could remove that CSP line from the files you saved from Wikipedia.