Search code examples
appletcheerpj

For CheerpJ script: Using both <cheerjp-applet> and <applet> on same page


I began a very helpful discussion with Alessandro Pignotti (@alexp-sssup) on https://gitter.im/leaningtech/cheerpj?at=5f189bf76279c91f420801af

about how to get Java applet byte-code to work with CherrpJ in present-day browsers.

Hopefully the two examples referenced there in this post can serve as a guide to others who might also be struggling with getting the basics of java applet conversion with CheerpJ going.

As I mentioned there I would, I am now putting this follow-up question in stackoverflow:

I was hoping to get this page to work in which I am trying to run the same byte-code with both the <cheerjp-applet> and <applet> tags on the same page. However the page never loads properly. The best I can achieve is (with page loading seeming to hang) to force some hung script to stop, which then often ends up bringing the CheerjP button up, but I have yet to the get button in the original applet to show on the same page (in a java-enabled browser-setup where the legacy applet does work properly from this page). Sometimes the browser completely hangs before even the Cheerpj script gets to work.

So my question is: Is what I am attempting even possible, and if so what could be wrong with this first attempt of mine?

P.S.: The stackoverflow tag [cheerpj] does not exist, so the suggestion on Gitter to use it fails for me: I don't have a reputation of 1500 :( !!! Since a pretty thorough web search has revealed very little in-depth technical discussion about CheerpJ besides what's in the Gitter CheerpJ room I reference at the start of this post, I am not sure how far the attempt to move discussion in to stackoverflow is going to go.


Solution

  • What you are trying to achieve is not supported by CheerpJ. When CheerpJ starts it will automatically replace any <applet>, <object> or <embed> tag containing Java applets and execute them internally. The special prefixed tags, such as <cheerpj-applet> are designed to avoid accidental execution by the native plugin if installed.

    We don't plan to support this use case in the future since for the vast majority of users the native Java plugin does not work anymore anyway.

    You may consider using two <iframe> tags to get the behavior you want using 2 independent pages.