Hot questions for Using Applets in google chrome

Top Java Programmings / Applets / google chrome

Question:

I am working in a web application using ASP.net and C#.

My target is to check on a desktop application on the client machine .. If it was exist then I should launch it. Else if it wasn't exist, we should download, install and then launch it.

I could develop this module using Java Applet but unfortunately, Google decided to disable NPAPI in September 2015, So the applet will not working on Chrome.

My question is about the Applet alternatives to help me implementing the above scenario ?


Answer:

The only (semi) viable option as far as I can see, is to offer the Chrome user a link to a JNLP file for a desktop application. Then when/if the JWS desktop application starts, have it report back to the server 'loaded OK' and then 'target app. installed/not installed'.

On your server, have a time out for waiting on the client to report back. If it passes that time, presume the client machine does not support Java at all and the user is checking some web service to try and figure out what app. opens a JNLP!

Question:

We have an Applet we used to zip files on the client machine and stream the content back to our servers. Our clients that have updated to the newer versions of Chrome are no longer able to use our Applet because Chrome does not support NPAPI plugins any longer. I think I have a couple of options:

  1. To somehow make the existing Applet work with Chrome (perhaps using JNLP? ) or some other method
  2. To find an alternative technology altogether

The solution has to be able to receive a list of folders, sub-folders and file names. It then has to be able to compress these files, if possible, then upload them to the server. I am open to any suggestions.


Answer:

You can

  • Read the file(s) with the File API, potentially letting the user add them to your interface via drag and drop (for a more convenient selection mechanism than boring <input type="file"> :-) ).

  • Zip them up in JavaScript using a library like JSZip (though if your server has gzip enabled, I'm not sure you gain a lot doing that; I haven't looked into it deeply, though)

  • Send them to the server either via HTTP POST (possibly multiple posts), or by using XMLHttpRequest2, or via web sockets.

Of course, your other alternative is to continue to use Java and have the users use Firefox instead of Chrome. Just beware that Mozilla is also looking to make a move away from NPAPI and away from supporting Java. About 20 months ago they weren't:

there are no plans of dropping support for java or other npapi plugins in firefox other than setting them to "ask to activate": https://blog.mozilla.org/security/2014/02/28/update-on-plugin-activation/

....but now:

Mozilla intends to remove support for most NPAPI plugins in Firefox by the end of 2016. Firefox began this process several years ago...

(which puts the lie to "no plans" in the first quote)

...Websites and publishers which currently use plugins such as Silverlight or Java should accelerate their transition to Web technologies.

Question:

How Chrome launches JNLP files is different from how other browsers handle it. Chrome treats that as a download rather than application file where the application needs to be launched to handle it.

So the JNLP file gets downloaded - Chrome asks if you want to keep or discard it & you have keep it & then click on it to the launch the JNLP application.

Oracle has advised people to move from Applets to JNLP.

However, this behaviour of Chrome makes it very difficult to migrate Applets to JNLP except in controlled environments. If you have a site with lots of users you aren't in control of - many of them will not download a file & click on it to run it.

OTOH, an applet would launch after you click on "You sure you want to run this applet" kind of dialogs.

Is there a way to make this migration from Applets to JNLP smoother?

EDIT: Things have changed between the time Launch webstart without downloading...? was asked and answered. There was a workaround then (described in the accepted answer) - this worked is no longer applicable now because Chrome no longer runs applets.


Answer:

The chrome problem you mention with the JNLP is a known chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=10877

Despite this ticket is marked as Fixed, it is not fixed in real. I still get this problem with my version: 51.0.2704.103 m

Among the comments of the chrome ticket you can find some workaround hints which might work in some environments but not in general.

What you can do:

  1. As a workaround you can suggest other browsers for your customers: Firefox, Internet Explorer to work with JNLP applications. (This is what we do in general.)

  2. You do not need any browser in general to start a JNLP application. Browsers also delegate this to the JRE javaws. So you can create a command line with your JNLP URL and you can put in into a script file. If you link that script to an icon you can start the JNLP application with one click.

%JAVA_HOME%\bin\javaws http://my/url/myapp.jnlp

  1. It is similar to 2. but you need to start the JNLP application once 1st in another way. In the JNLP (xml) file there is a section which you can fill to have an icon created after the 1st start.

    <shortcut online="true">
      <desktop/>
      <menu submenu="Start MyApp"/>
    </shortcut>    
    

In windows it will be created under: Start/All Programs/Start MyApp menu

Question:

In our web application, we used to use a Java applet to invoke MS. Office applications e.g. Word to open, edit, and save back a file to the server.

Google Chrome will no longer support NPAPI, so soon we can not run our applet in Chrome anymore. Plus, it seems that MS. Edge is not willing to support Java.

So, any suggestions for an alternative for the Java applet. We want to make the same experience for the user, just like before: we do not want to open the files in the browser, or at least try giving the user the same experience as before, meaning a neat editor to edit/save his/her file.

I have also tried Html5 features e.g. FileSystem API. But, it turned out to me that at least that feature cannot help me. (to my knowledge, maybe I am missing something)

Summary: How to launch client applications e.g. MS. Word using Javascript/Html5 without any applets/activeX?


Answer:

From what I'm understanding is you want a way to open an a file using a specific application (MS Word?) and then when the user saves the file it is automatically updated to the server?

You can achieve this by storing the file as a temporary file and automatically checking if the file has changed every few seconds.

This can be achieved using a real-time javascript framework such as NodeJS. The application launch could be met using the following: https://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx

Or perhaps a direct <a href="file://C:/path/to/temp/word.docx">Word</a> would work.

Question:

http://blog.chromium.org/2014/11/the-final-countdown-for-npapi.html

In September 2013, Google announced that their Chrome browser would no longer support the Netscape Plug-in API (NPAPI). This means that Chrome will block the installation of the Java plug-in used by our software through applet support, in legacy versions.

Google plans to gradually discontinue support for NPAPI during 2015: • In April, NPAPI support will be disabled by default, but Chrome will provide an override that can be applied by individual users (via chrome://flags) and enterprises (via Enterprise Policy). • In September, Chrome will remove the above override and NPAPI support will be permanently removed.

I have scoured around, attempting to find more specifics but without any information forth coming. Can anyone provide me with the date or projected release version in April 2015 when this feature will be disabled by default and similarly for the complete removal in September?


Answer:

Chrome is on a roughly 6-week release cycle, so you can make educated guesses about which versions are going to be released in April and September. Specific dates are never available for future releases, so you're not going to be able to get a definitive answer for that part of your question.