Viewing uploaded files online instead of downloading

After uploading a file in a form, when you view the form later you can click on it and it downloads.

Is there any solution (e.g. JS library) that can generically enable online viewing of these attachments instead of downloading. Would like to use it in a blank app so files and not downloaded to the local machine each time viewing is desired.