webodf / ViewerJS

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

Unable to find a good href #211

Closed hallshouse closed 7 years ago

hallshouse commented 8 years ago

Thanks for providing ViewerJS on GitHub and providing it as AGPL3.

I'm using jQueryFileTree.js to access my files and trying to use ViewerJS to display them in my iFrame. jQueryFileTree.js want to use <a href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $filename) . "\">" . htmlentities($name) . " to link to a file and this works fine for it.

I'm trying to integrate the ViewerJS example into this link <a href="/ViewerJS/#../ and it does not appear to work.

My ViewerJS folder is at the root of my site and my files reside at the same level in \media_viewer_content\topics.

I've tried a few different A link settings having /ViewerJs/ in them and I still get the Windows Open file dialogue.

Can you suggest an A link setting that would work for this?

UPDATE: I just tried this: http://127.0.0.1:9000/ViewerJS/index.html#../media_viewer_content/topics/topic2/myfile.xlsx and it opens ViewerJS, but not the document.

UPDATE: Actually, I'm now seeing the following results: http://127.0.0.1:9000/ViewerJS/index.html#../media_viewer_content/topics/topic1/myText.txt opens in my iFrame, but not using ViewerJS.. http://127.0.0.1:9000/ViewerJS/index.html#../media_viewer_content/topics/topic2/myfile.xlsx does not open, but wants to download. http://127.0.0.1:9000/ViewerJS/#../media_viewer_content/topics/topic2/myfile.ods opens in ViewerJs, but wants to download in my iFrame. http://127.0.0.1:9000/ViewerJS/#../media_viewer_content/topics/topic3/myPDF.pdf opens in ViewerJS, but opens in my default FF PDF viewer within my iFrame in the website.

So, clearly I have a path issue that I'm not able to resolve.

leenaars commented 7 years ago

It seems you are trying to open the wrong file format (xslx). ViewerJs does not support this. If you use OpenDocument Format (ISO 26300) it should work just fine.