Display a PDF Document

I’d like to open a PDF document when a user presses a button (onclick) so they can read the details. The following seems to work, but I wanted to get some feedback. This is a WebApp

Currently I’m just opening a new window with code like:

window.open('Resourse in Appstudio Project.pdf');

This seems to work fine, but I’m concerned it’s because I installed adobe on every device I own.

Maybe you should check for mime-types and indicate the installation of a PDF viewer in the case none is installed.

Just in case anyone wants to know how this is done: :nerd_face:

var PDFexists;
PDFexists = false;
for (xi = 0; xi < navigator.mimeTypes.length; xi++) {
    if(navigator.mimeTypes[xi].type == 'application/pdf') {
         PDFexists = true;
    };
  };
console.log(PDFexists);

NOTE: it is important to check the mime type, not the file extension. The browser uses the mime type to determine the viewer, not the file name extension. The mime type is sent from the server as the content-type header. Make sure your server is putting out the content-type you think it is.