Re: fetching files with javascript

Bela Lubkin <[email protected]>
Newsgroups gmane.comp.web.lynx.devel
Message-ID <[email protected]>
What I am taking out of this discussion is:

When using the Lynx keyboard command 'p'(rint) and then its menu choice
'Save to a local file' -- it is inconvenient that the default filename
it supplies includes '?parameters' (and '#frag').

There may be (probably are) other actions within Lynx which similarly
provide a proposed filename derived from a URL.

Request: add to Lynx user options directing it to strip '?params' and
'#frag' from proposed filenames.  Two options so each user can
construct their own preferred behavior.  And, I *think* I would set them
by default to do all the stripping; people could get back the current
behavior by changing the settings.(*)

Another way to handle this would be a new sub-menu: instead of providing
an input buffer pre-filled with the end of the URL, offer selections;
like:

  Saving https://foo.bar.baz/long-obnoxious-name.html?param#frag

  Choose filename:

    1) Type a new name interactively
    2) long-obnoxious-name.html
    3) long-obnoxious-name.html?param#frag
    4) long-obnoxious-name.html?param
    5) long-obnoxious-name.html#frag

(intentionally ordered so #1 is always 'type', #2 is always 'fully
stripped'; #3 only present if param or frag present, then is always
'fully unstripped'; #4 and #5 only appear if input URL has *both* param
and frag.)

There is also a much subtler way this could be implemented.  Currently,
the filename prompt is pre-filled with the last segment of the URL, in
an interactive edit buffer.  And this buffer has history; up-arrow takes
one to the last-saved filename, and so on.  Suppose, then, that the
temporary history buffer for 'foo.html?bar#bar' were pre-filled with the
various stripped forms, *then* followed by actual past history?  For
URLs without ?#, nothing changes at all.  For ones with, reaching real
history is 1-3 extra up-arrows away.  Whatever is selected should then
append to the real history (that is: the proposed alternatives from the
last previous save should *not* leak into the ongoing history buffer).

(*)I'm not sure if there are non-interactive actions which automatically
download URL targets to names derived in this manner.  If yes, it seems
like this would interact badly; e.g. downloading a site recursively and
it has a page offering 'data.cgi?tbl=foo' and 'data.cgi?tbl=bar', which
would then overwrite each other.  In which case, scratch the settings
idea, just do the prompt; only for interactive use.  And possibly add
command line flags directing such strippage, so automatic downloads
could do it *if and when* the caller found it appropriate.

>Bela<
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.