5

Just out of curiosity, between <applet> vs <object> for a Java applet, which one should I use? I know that <applet> is deprecated, however Sun still recommends the use of <applet>.

Is there any drawback between the two tags? Because when I use <object> for Mac in Safari, it causes a problem saying that the page can't load, even though the page loaded properly, and when I check the activity window it said that the class was not found/cancelled. For example:

enter image description here


Use <object>. <applet> was deprecated back in HTML 4.01.

Unless you're targeting a stone-age environment, there is not reason to acknowledge the existence of the applet tag.

4

4 に答える 4

6

Use applet if you have found that it works more often. The object element was introduced as a theoretical unification that would be a catch-all for any embedding of external data. It never worked well, and modern HTML development has effectively abandoned the unification idea. HTML5 introduces audio and video, for example and keeps img (logical unification would surely deprecate img, because an image can be embedded with object).

于 2012-04-09T16:47:52.507 に答える
4

Use deployJava.js as mentioned in the applet info. page..

..To avoid browser compatibility issues, the Deployment Toolkit script provides JavaScript functions that automatically generate the HTML required to deploy RIAs. Developers should invoke these functions to deploy their solutions in a consistent fashion across various browsers.

Then you don't have worry about whether the script writes an applet, object or embed element.


As an aside. Copy/pasting the text from the Activity window would be a lot more useful than a screen-shot. Now I look (squint) at it, it seems the only two lines of output that are in any way relevant are:

The css/none is not a class or a Jar, and neither of them exist on the server. So that applet has problems beyond the HTML elements used to deploy it.

于 2012-04-09T16:47:02.757 に答える
0

I think Sun has a point. HTML5 says:

The applet element is now obsoleted so that all extension frameworks (Java, .NET, Flash, etc) are handled in a consistent manner.

In other words, it's no longer valid for reasons of theoretical purity and not because of any practical problem. Frankly, I find <applet> simpler and more reliable to use in the real world and continue to use it.

While deployJava.js might hide the gory details away, the reality is that under the hood, it still uses <applet> in some circumstances.

于 2012-04-09T16:57:01.540 に答える
0

を使用し<object>ます。HTML 4.01<applet>廃止されました。

石器時代の環境をターゲットにしている場合を除き、アプレット タグの存在を認める理由はありません。

于 2012-04-09T16:22:33.197 に答える