Try the fastest and simplest way to install ONLYOFFICE

CallbackURL in pure HTML and JS usage of onlyOffice

Document Server releases and description of the update.

CallbackURL in pure HTML and JS usage of onlyOffice

Postby Enelvin » Tue Mar 13, 2018 11:17 am

I want to use onlyOffice inside of a pure HTML and Javascript file. (All of their official examples are based on dynamic web pages like PHP, Node.JS and so on)

SO I installed the integration server of Onlyoffice and made the following html file based on the information placed here:

Code: Select all
<html>
<head>
</head>
<body>
<div id="placeholder"></div>
<script type="text/javascript" src="http://localhost/web-apps/apps/api/documents/api.js"></script>
<script>
var config = {
    "document": {
        "fileType": "docx",
        "key": "Khirz6zTPdfd7",
        "permissions": {
            "comment": true,
            "download": true,
            "edit": true,
            "print": true,
            "review": true
        },
        "title": "Example Document Title.docx",
        "url": "http://localhost:9500/martin/new.docx"
    },
    "documentType": "text",
    "editorConfig": {
        "callbackUrl": "http://example.com/url-to-callback.ashx"
    }
};
var docEditor = new DocsAPI.DocEditor("placeholder", config);

</script>
</body>
</html>


This code show the editor correctly and load the file. The only problem is callbackUrl which is not well explained in the API.

Now the questions are:

What is the correct callback url? Is this file exist somewhere in the installed integration server?

I guess I have to develope the url-to-callback.ashx file. In case yes then what do I have to write for this file? (Please note I can just use JS and not PHP or other dynamic web languages)
Enelvin
 
Posts: 3
Joined: Tue Mar 06, 2018 10:12 am

Re: CallbackURL in pure HTML and JS usage of onlyOffice

Postby Maxim » Fri Mar 16, 2018 12:27 pm

Hello Enelvin!
You cannot save the documents using JS and html only. If you delete callbackUrl you will be able just to open a doc. But for saving you need request handler.
Maxim
 
Posts: 1593
Joined: Tue Oct 11, 2016 2:34 pm

Re: CallbackURL in pure HTML and JS usage of onlyOffice

Postby Enelvin » Mon Mar 26, 2018 3:37 pm

Hello, Maxim!

Can you help me create this request handler?

I plan to experiment in Python!

I'm having a hard time with this.

But before we even continue I want to tell you that the file in Onlyoffice does not even open.

As you can see in the image, the editor opens but does not allow any editing.

Image
Enelvin
 
Posts: 3
Joined: Tue Mar 06, 2018 10:12 am

Re: CallbackURL in pure HTML and JS usage of onlyOffice

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

Hello Enelvin!
Can you help me create this request handler?

Unfortunately no. Why do you need Document Server? What for?
Maxim
 
Posts: 1593
Joined: Tue Oct 11, 2016 2:34 pm


Return to Document Server

Who is online

Users browsing this forum: No registered users and 1 guest

cron