Open Bug 180523 Opened 22 years ago Updated 2 years ago

Option for saving with BASE HREF added?

Categories

(Firefox :: File Handling, enhancement)

enhancement

Tracking

()

People

(Reporter: deven, Unassigned)

Details

Currently, if a user saves a webpage to a file, and then tries to view the file,
links and inline images won't load correctly.  I'd like to suggest an enhancement,
to modify the <HEAD> section (adding one if necessary) of the saved HTML to add
an appropriate <BASE HREF=... /> reference, if missing.  (Using the URL of the
page being saved, of course.)  This would allow the saved page to work cleanly
without need for modification by the user.

If the HTML already has a BASE reference, it should be left alone, of course.

Since some users will want to save the exact source of the page, it would
probably be good to have a checkbox to disable this modification when desired,
but it would probably be good to have it checked by default...  (I don't know if
an additional pref to set the default is appropriate here or not.)
This is why when you're saving you can choose between "web page, html only" and
"web page, complete" in the filepicker...
Actually, I'm suggesting something different...

The "Web Page, complete" option actually downloads the inline images and doctors
up all the references.  This is a good and useful option; someone might want to
save a page without having to worry about whether the images will be available
later to display the downloaded page properly.

I'm suggesting an option where only the HTML file is saved, not the images --
but a <BASE HREF="..."> is added to the <HEAD> section.  This way, the local
HTML file can be displayed properly, fetching the images from the original
location instead of saving a copy of the images locally.

Since there's already that drop-down box, I'd suggest making the "Web Page, HTML
only" option save with the <BASE HREF="..."> added, and add a new option for
"Web Page, unmodified HTML" to save the downloaded HTML, byte for byte.

As an aside, why does "Web Page, complete" doctor the individual HREFs when it
could just add the <BASE HREF="..."> directive instead?  The latter seems much
cleaner and more straightforward.  Is there a downside I'm missing here?
-> File Handling
Assignee: asa → law
Component: Browser-General → File Handling
QA Contact: asa → petersen
I would like to concur with the submitter of this report.  There is good reason
to save the BASE href information: 1)  Images and such are displayed, but they
don't clutter up your drive, and you only have a single file to deal with  2) 
In most cases, it lets you know where the original is sitting.

I've written a separet emacs utility, whose task is to open up a selected file,
look for the first place after the <head> tag and then insert the <base
href=...> info.  So far, I've been very happy with the results.

However, the procedure is longer than I'd wish.  I must first save the page as
html only (can't get past that), and then I must copy what's in the address bar
(Alt+d, ctrl+c), go to the Save file dialog (ctrl+s), right click with the mouse
to bring up the popup menu, select my special save function, now click cancel to
dismiss the dialog.  That's three keystrokes and 3 mouse clicks too many.

Or how about let me have as a settable option:  Save with BASE=underlying url if
there is not already one included.

Csaba Gabor from Vienna
Assignee: law → nobody
QA Contact: chrispetersen → file-handling
Product: Core → Firefox
Version: Trunk → unspecified
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.