Opening links in a new window
A feature request landed in my Inbox today, asking me to change how a document link was working.
The link is to a file that a user uploads, and there are no constraints on the file type. I coded the view to always force a download dialog as I wanted the behaviour of that link to be the same across all browsers, and not be at the whim and pleasure of what plugins are installed.
The dreaded feature request was to change the link to open a new tab or window and display the file in the browser. After outlining my reasons for the current format, and explaining that having two links to the same resource (one with a forced download dialog, the other without) was a bad idea, the client was surprisingly receptive to my “let the browser handle it”** strategy.
The result is that we have a single link and we let the browser handle the HTTP request in what ever manner it can. If the user wants to open a new tab or window, they must use the context menu. If they want to download the file, they must use the context menu.
Needless to say I’m happy with the outcome. Cleaner code, a cleaner interface, and we let the browser do what it’s supposed to do.