Try the fastest and simplest way to install ONLYOFFICE

Query String Version Parameter

Any issues about docs (uploading, editing and etc.)

Query String Version Parameter

Postby eaglejs » Fri Mar 23, 2018 12:11 am


The Problem
I'm trying to view a particular version of the word document we have uploaded by generating a list of 'links' displaying the versions in our application. When I click on that link of a particular version, it should take me to the onlyoffice editor and load that version of the word doc.

So if I clicked on version 2 of a document link, it should show me version 2 of the word document in the onlyoffice editor.

What I have tried
I'm trying to pass a query string that has the word doc along with the version number of that word doc that I wish onlyoffice to load. For example:
Code: Select all

I can load the word document successfully this way, however, using the version number in this manner, I'm still not sure what I need to do in order to get it working.

Currently, in my config for onlyoffice for the document editor, I am trying to grab this version and pass it in like so.

Code: Select all
var config = {
    events: {
        onRequestHistory: function () {
                "currentVersion": parseInt(document.version),
                "history": []

Based on the documentation, it appears I need to somehow get the history and pass it in as well, but I'm not entirely sure how do get this done. I looked at the nodejs example onlyoffice has provided, however, I am unable to get it working correctly and it complains about the token being unverified after I have uploaded a document, I clicked on that document, and when the onlyoffice editor loads I get the token error.

I looked at the code a bit and it appears the onlyoffice config in the nodejs example has 'token.enabled' set to false. I enabled it and I still get the same error.

Ultimately, my question is this... Do I need to generate the history as well and pass it in? Or does onlyoffice see that I passed in the version and knows that I want to view that particular version of the document? The documentation is a little fuzzy on this subject. I'm someone who loves to look at the working code to really get the context as to what is going on. So if anyone has a github with versioning working similarly, I would love to know how you got this working. Thank you so much for your time. :)

- Josh
Posts: 6
Joined: Thu Oct 05, 2017 2:01 am

Re: Query String Version Parameter

Postby Maxim » Tue Apr 03, 2018 10:38 am

Hello eaglejs!
Maybe thiswill help you
Posts: 1558
Joined: Tue Oct 11, 2016 2:34 pm

Return to Documents

Who is online

Users browsing this forum: No registered users and 1 guest