Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

html

applet

I'm embedding a Java applet like this:

<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:

Chrome shows this error in the console:

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.

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.

like image 993
kayahr Avatar asked Dec 21 '12 11:12

kayahr


1 Answers

I found that this issue occurs when applet's code parameter is set in the param tag. If you move it to the corresponding object's attribute, 404 error no longer appear:

<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

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.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

like image 138
Tanya Vybornova Avatar answered Nov 10 '22 11:11

Tanya Vybornova