Hey guys,
I wasn't completely sure if this would be a Java or JS topic, but I thought it had more to do with Ajax and whatnot. Anyway, I have an embedded and signed Java applet on my page like so:
<applet style="position:absolute;left:-1px" code="fileSaver.class" archive="SignedFileSaver.jar" width="1" height="1"></applet>
this applet's jar is signed, and it requests to get file access privilages. the actual function is called from an external javascript, like so:
document.applets[0].saveFile("classes.xml", data);
The source code for the file saver is as so:
import java.io.*;
import java.lang.*;
public class fileSaver extends java.applet.Applet {
public int saveFile(String filename, String data) {
try {
File file=new File(filename);
if (file.exists()) {
file.delete();
}
file.createNewFile();
System.out.println(data);
FileOutputStream fileio = new FileOutputStream(file);
fileio.write(data.getBytes());
fileio.close();
return 1;
} catch (Exception x) {
x.printStackTrace();
return 0;
}
}
}
The problem is, even after I accept the signiture, the browser won't allow the privilaged action of the applet. Is this maybe because I haven't signed the javascript file? If it is, how exactly do I sign it? I looked around, but nothing actually told me how to sign a js file. Thanks in advance.
jin