Basically, I have different files stored on a server and I want to show/view the files in an iframe using their links. If a file is an image, it works as intended showing the image, but other files like .doc or .pptx gets downloaded instead. How can I detect that download event so that I can prevent it and show a 'No preview available' warning?
Here's the part where I display the files. I don't really know where to go from here.
<div id="file-container">
<iframe src="/file/from/server.xyz" frameborder="0"></iframe>
</div>