From a visual force page on a button click i am opening documents using following javascript function
<button type="button" class="wpsButtonText" onclick="javascript:download()">I Accept</button>
function download()
{
var params = getParams();
if (params["id"])
{
location.href = "https://test.salesforce.com/sfc/servlet.shepherd/version/download/" + unescape(params["id"]);
}
return(0);
}
But the problem is of type pdf it is opening in the same tab instead of downloading but when the document is of type html it is directly downloading without any preview
For PDF
For HTML
is there any approach to make even html to open directly in the browser without downloading