Using content-type for choosing the viewer instead of extension

With the current implementation of the loadDocument function it's possible to use Viewer.js with a URL in this form: http://server/path/file.pdf. If when have a dynamic file, with a URL like this http://server/myscript.php the viewer,js doesn't work. This is because the selection of the viewer is based on the extension of the file. I used a AJAX request to get the content-type of the file, in this way
we can use viewer.js with REST services.