0

I currently have a web app, which allows users to download files to their computers, edit them with their own editors and automatically sends them back to server upon saving and sends some extra data when closing the file. It utilises a Java applet to handle the client side processing which includes

  • file download,
  • sending request to lock the file,
  • opening the file in default desktop app,
  • watching for changes,
  • file upload back to server,
  • sending request to unlock the file upon closing.

Since chrome will stop supporting NPAPI in September, I need to create an alternative while maintaining the funcionality. I wasn't able to find many alternatives. The only thing I found that would be able to achieve at least something is Native Messaging, but still I can't imagine how could I use it to emulate the behavior of the java applet.

So the question is - what are possible alternatives I can use to replace the applet?

Elwhis
  • 1,241
  • 2
  • 23
  • 45
  • What part of the behavior do you not see how to do in native messaging? That seems like the obvious choice to me – taxilian Jun 28 '15 at 00:29
  • Well from what I have seen I can't imagine using the native messaging to achieve such thing. Could you please guide me somehow to get better insight into how native messaging can handle such a thing? – Elwhis Jun 30 '15 at 05:51
  • What part of the behavior do you not see how to do in native messaging? – taxilian Jun 30 '15 at 18:57
  • To try to be more clear, it seems very obvious to me that native messaging would work fine for what you're trying to do; therefore one of us must not be seeing the whole picture. If you can elaborate on what doesn't seem possible then perhaps someone could answer your question more successfully (or confirm that it won't work, as the case may be) – taxilian Jul 01 '15 at 05:08
  • It is definitely me, who is not seeing the whole picture. The thing is, I have no prior experience with native messaging and the documentation on this doesn't give me much info I need. How can I for example handle the file download and open it in native app, lets say a docx file in word or a xlsx in excel? – Elwhis Jul 01 '15 at 08:13

1 Answers1

0

Looking at your comments, I'm going to break down your question into 2 basic questions:

  1. How does native messaging work?
  2. How do I download a file and launch it in an application, etc, in a windows application?

Native messaging essentially allows you to launch an application (which must be registered when installed to allow it to work this way) which can communicate with your extension. You can then talk back and forth with your native messaging application from your extension (or from the web page proxying requests through your extension); your messages have to be essentially json formatted (on the javascript side you provide json encodable values and on the executable side you have to read that from stdin and parse it, then write to stdout the result; there are also 2 byte integers preceding each message indicating the length of the message).

basically once you have communications, you just have to make your application be able to respond to a message that tells it to download the file by doing so, etc. This is something you'll have to figure out how to do -- you could do it with a python script, a windows exe, a .net app, or whatever you want that can be executed, but each has advantages and disadvantages.

Hope that helps

taxilian
  • 14,229
  • 4
  • 34
  • 73
  • So I have to create a browser extension or what kind of extension do you mean? And for the second point - how can I just by sending messages find out what is going on with a file for example a Word document. Word propably does not have any API for such purpose. Do I get it correctly that I would have to develop both a browser extension and a desktop app in order to achieve the original functionality? – Elwhis Jul 07 '15 at 06:19
  • Word actually does have APIs to do that, otherwise your java app couldn't have done it. Yes, you'd need a browser extension, and yes you understand correctly that you would have to develop both a browser extension and a desktop app in order to achieve the original functionality -- however, there is no reason you couldn't use java to do it and talk back to the browser with messages. You use javascript to provide the glue. – taxilian Jul 08 '15 at 02:08