I am getting Access Denied exception when I am calling a Java Script Function from Java Applet only in IE. ( modified my original question with updated information.)
Here is my HTML code
<script type="text/javascript">
function uploadComplete() {
alert("in Upload Complete");
ju.doneUpload(true);
}
</script>
ju
is declared globally in the same page which calls the doneUpload from a different JavaScript file. I have included MAYSCRIPT in my applet Tag.
Java Code [After adding AccessController] :
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
JSObject scriptObject = getScriptObject(uploadDialogBox.applet);
if(scriptObject != null) {
try {
// this is the call where it throws an exception
**scriptObject.call("uploadComplete", null);**
} catch(JSException e) {
System.out.println("exception " + e.getMessage()
+ " WrappendException " + e.getWrappedException()
+ " stack trace " + e.getStackTrace());
}
}
return null;
}
});
private JSObject getScriptObject(JApplet appletInstance) {
JSObject result = null;
// JSObject doc = null;
try {
result = JSObject.getWindow(appletInstance);
// doc = (JSObject) result.getMember("document");
} catch (JSException e) {
System.out.println("Exception in getScriptObject : " + e.getMessage()
+ " Wrappend exception " + e.getWrappedException());
}
return result;
}
It throws an JSException: Access is denied
The alert
function in uploadComplete
is not called. What am I doing wrong here?