Anchor download Filename Attr
Serializes a suggested filename into a double-quoted anchor download attribute. Empty filename requests downloading without a suggested name. Browser origin policy and filesystem filename sanitization are separate.
Description
The anchor download attribute requests downloading and can suggest a filename.
The anchor download attribute requests downloading and can suggest a filename. Attribute escaping protects the markup representation, while a browser may separately alter the eventual filename.1
The tool returns attribute, hasSuggestedFilename. The fields describe the supplied local pattern or effective state, or contain the formatted markup shown below.
When to use Anchor download Filename Attr
Use this for the following task: Serializes a suggested filename into a double-quoted anchor download attribute. Empty filename requests downloading without a suggested name. Browser origin policy and filesystem filename sanitization are separate. Provide the requested local fields extracted from the relevant element or attribute.
How to use Anchor download Filename Attr and understand its results
- Prepare the parsed element names, attribute values or direct element-child lists requested below. Keep attribute presence separate from its value.
- Enter filename according to the field table, then run the tool.
- Read attribute, hasSuggestedFilename. Check the effective state, recognized-token flags or generated markup against the rules below.
- Correct any reported local mismatch and check the resulting markup in its intended document and browser context.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| filename | Filename | string; maximum text length 100000 | Required |
Supply the desired filename or an empty string. Reject null, carriage return and newline, then escape &, double quote, < and > for a double-quoted attribute.
attribute=download="escaped filename"; hasSuggestedFilename = filename is nonempty The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| attribute | Attribute | string |
| hasSuggestedFilename | Has Suggested Filename | boolean |
{
"input": {
"filename": "report & \"notes\".csv"
},
"output": {
"attribute": "download=\"report & "notes".csv\"",
"hasSuggestedFilename": true
}
} Limitations and assumptions
No resource is downloaded. Origin restrictions, Content-Disposition and filesystem filename sanitization remain separate, and a filename suggestion is not a guarantee.
The tool does not fetch a page, run a browser or validate an entire HTML document. Malformed tool requests produce input errors; valid requests can still report unrecognized values or failed local checks.
Alternative or Complementary methods
Choose Anchor target Values Lookup when you need its operation: Classifies standard HTML navigable target keywords or valid named targets. Empty values default to the current context. Browser-specific target extensions are excluded. Choose Meta Refresh seconds;url Format for the complementary operation: Builds an escaped meta refresh element from a nonnegative integer delay in seconds and an absolute HTTP(S) URL. The URL is normalized with the portable WHATWG URL helper; relative URLs and fractional-delay parser behavior are outside this builder profile.
Background reference: HTML Standard: Anchor download Filename Attr.
References
Similar or alternative tools
- Anchor target Values Lookup
Classifies standard HTML navigable target keywords or valid named targets. Empty values default to the current context. Browser-specific target extensions are excluded.
- Meta Refresh seconds;url Format
Builds an escaped meta refresh element from a nonnegative integer delay in seconds and an absolute HTTP(S) URL. The URL is normalized with the portable WHATWG URL helper; relative URLs and fractional-delay parser behavior are outside this builder profile.