I just want to know which file types (like .png, .pdf, .txt) can be viewed in browser (like Chrome, Firefox). Because sometimes when i click on file link, instead of displaying in browser it download automatically. Why this happens ? Below is my code. Any help will be appreciated.
<script>
function openPDF(url){
var w=window.open(url, '_blank');
w.focus();
}
</script>
<a href="burger1.jpg" target='_blank'>link</a>
<div onclick="openPDF('1.pdf');">PDF 1</div>
In normal cases, following files can be viewed in browser.
.PNG .JPEG .PDF .doc etc ...
and following files will always be download.
.zip .exe etc ...
But in special cases, it depends on user browser settings and preference. You can get further details from this link.