NPAPI alternative for live file editing

305 views Asked by At

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?

1

There are 1 answers

2
taxilian On

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