0

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.


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.

4

1 回答 1

0

CheerpJ 不支持您尝试实现的目标。当 CheerpJ 启动时,它将自动替换任何包含 Java 小程序的<applet><object>或标记并在内部执行它们。<embed>特殊的前缀标签,例如<cheerpj-applet>旨在避免本机插件意外执行(如果已安装)。

我们不打算在未来支持这个用例,因为对于绝大多数用户来说,原生 Java 插件无论如何都不再工作了。

您可以考虑使用两个<iframe>标签来获得您想要使用 2 个独立页面的行为。

于 2020-07-24T09:31:11.743 回答