简体   繁体   English

Webkit尝试从JAR读取Java applet类之前先下载它

[英]Webkit tries to download Java applet class before reading it from JAR

I'm embedding a Java applet like this: 我正在嵌入这样的Java小程序:

<object type="application/x-java-applet">
  <param name="codebase" value="/path/to/jar" />
  <param name="archive" value="myapplet.jar" />' +
  <param name="code" value="my.package.MyClass" />
</object>

The applet works fine in all browsers but Webkit browsers (Chrome and Safari) are both annoying the server with a useless request which tries to download the MyClass file (Which is in the JAR and works fine from there) from the server: 该小程序在所有浏览器中都可以正常运行,但是Webkit浏览器(Chrome和Safari)都以无用的请求烦扰服务器,该请求试图从服务器下载MyClass文件(在JAR中并且可以从那里正常工作):

Chrome shows this error in the console: Chrome在控制台中显示此错误:

GET http://localhost/test/my.package.MyClass 404 (Not Found) 

The same happens when using the <embed> tag instead of <object> but it doesn't happen when using the deprecated <applet> tag. 使用<embed>标记而不是<object>时,会发生相同的情况,但使用已弃用的<applet>标记时,则不会发生。

Is there a possibility to prevent this class file downloading somehow? 是否有可能阻止此类文件下载? I heard rumors about a codebase_lookup parameter but setting this param to false doesn't change anything. 我听说有关codebase_lookup参数的传言,但将此参数设置为false不会改变任何内容。

I found that this issue occurs when applet's code parameter is set in the param tag. 我发现在param标记中设置了applet的code参数时,会发生此问题。 If you move it to the corresponding object 's attribute, 404 error no longer appear: 如果将其移至相应对象的属性,则不会再出现404错误:

<object type="application/x-java-applet" code="my.package.MyClass">
   <param name="codebase" value="/path/to/jar" />
   <param name="archive" value="myapplet.jar" />
</object>

Tested on: 经过测试:

Windows 8, Java 1.7.0_25: Chrome 28, Firefox 23, IE10 Windows 8,Java 1.7.0_25:Chrome 28,Firefox 23,IE10

OS X 10.6.8, Java 1.6.0_51: Chrome 28, Firefox 23, Safari 5.1.9 OS X 10.6.8,Java 1.6.0_51:Chrome 28,Firefox 23,Safari 5.1.9

OS X 10.7.5, Java 1.7.0_25: Firefox 23, Safari 6.0.5 OS X 10.7.5,Java 1.7.0_25:Firefox 23,Safari 6.0.5

OS X 10.8.4, Java 1.7.0.25: Firefox 23, Safari 6.0.5 OS X 10.8.4,Java 1.7.0.25:Firefox 23,Safari 6.0.5

OS X 10.9, Java 1.7.0_25, Firefox 23, Safari 7.0 OS X 10.9,Java 1.7.0_25,Firefox 23,Safari 7.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM