![]() Anticipating and answering the following questions can help: What? Give the user as much information as you can to help inform them on what’s about to happen. As we can’t modify how the browser’s download behavior itself operates, we should make the surrounding user experience as transparent and streamlined as possible. For less technologically-savvy individuals, it can be a disorienting and frustrating context shift.Īs responsible designers and developers, we want to make the experience of interacting with a download link as good as it possibly can be. The user has to shift their mental model from flitting from page-to-page and filling out forms to navigating a file system and extracting compressed archives. The default experience of downloading a file can be jarring-it typically isn’t part of our normal browsing behavior. ![]() Thanks, Scott! Designing a Good Download Link It side steps the attempt to render the file in the browser and instead says, “You know what? I’m just going to save this for later…” download augments the inherent functionality of the link retrieving data. Long story short, the download attribute is unique to anchor links for a reason. They can get data, in regards to the functionality of forms, but it continues to be within the context of updating a web document, not downloading an individual file. While they can be used to get data, it’s often to change state of a current document, not to retrieve and render a new one. Buttons perform actions, but they don’t inherently “get” documents. They retrieve information and download it. The confusion seems to come from developers getting super literal with the “links go places, buttons perform actions.” Yes, that is true, but links don’t actually go anywhere. psd file, the browser would initiate a document change to render the file, likely be all like, “lol wut?” and then just initiate the OS download prompt. The difference between a Photoshop file, HTML, and other understood media files, is that a browser automatically displays the latter two. HTML is a file, and like all other files, it needs to be retrieved from a server and downloaded before it can be presented to a user. The debate about whether a button or link should be used to download a file is a bit silly, as the whole purpose of a link has always been to download content. My friend Scott, who is paid to know these kinds of things, tells us: This might sound hyperbolic, but having a stable copy of something that works offline could make all the difference in a time of need. Using anchors for your download means that a person can access what they need, even in suboptimal situations.Ī robust solution is always the most desirable-in a time of crisis, it might even save a life. elements function even if JavaScript breaks. JavaScript is more brittle than we care to admit. ![]() Still not convinced? Here’s some more food for thought: Progressive Enhancement If that means storing an HTML document for use offline, we’re empowered to help make the experience as easy as possible. This raises a very important point: we can’t know every user’s reason for why they’re visiting our website, but we can use the tools made available to us to help guide them along their way. The presence of the attribute is effectively a human-authored flag that tells the browser to skip trying to render something it has retrieved and just store it instead: You’re still “navigating” to the file, only instead of viewing it, you’re snagging a copy for your own use.Īny kind of file can be a download! This even includes HTML, something the browser would typically display. It tells the browser that the destination of the link should be saved to your device instead of visiting it. One of those attributes is called download. ![]() Anchor link elements also possess a number of unique attributes that help control how they connect to other documents and files. Like all other elements, anchor links can be modified by HTML’s global attributes. They form the Semantic Web, the terribly wonderful, wonderfully terrible tangled ball of information that enables you to read this article at this very moment. The internet as we know it couldn’t exist without links. However, the W3C provides us with an important clue as to who is right: the download attribute. Much like tabs versus spaces or pullover hoodies versus zip-ups, this debate might rage without end. There seems to be a lot of confusion over when to use buttons and when to use links. What best describes a download? Is it a triggered action, and therefore should be in the domain of the element? Or is it a destination, and therefore best described using an element? Want a download? Well, you’re going to want… hmm. Want a paragraph? Our trusty friend is here, loyal as ever. Need a heading? You’ll want a heading element. The semantics inherent in HTML elements tell us what we’re supposed to use them for.
0 Comments
Leave a Reply. |