Advantages of showing file extension in URL?
I know there are lots of reasons to hide the file extension in your开发者_开发知识库 URLs. Is there any benefit to showing them, though?
A benefit would be that the filetype is evident when saving files from the browser, e.g. spreadsheet.ods
instead of spreadsheet
. This is especially valid for Windows systems who still don't consider the file's contents, but just the filename.
I think these days file extensions are less and less important. The MIME type of the item should be returned by the server which makes the ending rather redundant.
None, if the content is going to be viewed in the browser. For downloads or content you are expecting the user to interact with as Content-Disposition: attachment, users might prefer to see the familiar extensions. It's still perfectly possible though to serve files using URLs like example.com/audio/2011-05-08 and use the HTTP header to prompt the browser to use a filename with an extension when saving.
精彩评论