webodf / ViewerJS

ViewerJS: Document Reader in JavaScript
http://viewerjs.org
1.94k stars 421 forks source link

.odt file not opening but its downloading #275

Open navintati opened 5 years ago

navintati commented 5 years ago

Hey Friends i pull the viewerjs i did changes for .odt file in code and opening on the browser it's not opening but it's downloading the same odt file.

pls, friends, i need help.

zhangxuehong commented 4 years ago

same problem,don't know how to resolve.

thz commented 4 years ago

Can you link to a minimal example of how to reproduce the issue?

BaLaurent commented 3 years ago

Hi i'm facing the same issue and here's an extract of my code

js part : else if(format == "odf" || format == "odf" || format == "ott" || format == "txt" || format == "pdf"){ document.getElementById("previewDoc").removeAttribute("hidden"); document.getElementById("previewDoc").setAttribute("src",tmpPathFile+tmpPreviewFile["text"]); } i'm removing the src higher to "empty" it tmpPathFile end with a / and is the relative path to the folder containg the file which name is stored in tmpPreviewFile["text"], format is obtained like this : var format = tmpPreviewFile["text"].split("."); format = format[format.length-1];

my HTML part : `