问题
I'm forcing a download to be handled by the browser by setting the header Content-disposition
to inline;
Is there a way of setting the title this way? Currently it looks like the browser auto-fills it with the URL of the file.
回答1:
Yes, you can specify the filename just like you'd do for content-disposition: attachment
, i.e. like this:
Content-disposition: inline; filename="foo.bar"
See this post for some useful information about this header: How to encode the filename parameter of Content-Disposition header in HTTP?
来源:https://stackoverflow.com/questions/21789851/set-title-of-inline-file