Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8038247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:10:22+00:00 2026-06-05T03:10:22+00:00

I am using JSObject to invoke a Javascript function from my Applet. SSCCE of

  • 0

I am using JSObject to invoke a Javascript function from my Applet.

SSCCE of my Applet:

package ch.vrag.web;

import java.applet.Applet;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Permissions;
import java.security.Policy;

import netscape.javascript.JSObject;

public class Sscce extends Applet {

private static final long serialVersionUID = -5403444704039831864L;

public void init() {
    try {
        Policy.setPolicy(new Policy() {
            Permissions perms = new Permissions();

            public PermissionCollection getPermissions(CodeSource codesource) throws SecurityException {
                AllPermission grant = null;
                grant = new AllPermission();
                perms.add(grant);
                return perms;
            }

            public void refresh() {
                // Do nothing
            }
        });
    }
    catch (Exception e) {
    }

    JSObject window = JSObject.getWindow(this);

    JSObject phoneNums = (JSObject) window.eval("getWindowRectangle()");

    int x;
    int y;
    int width;
    int height;

    if (phoneNums.getSlot(0) instanceof Integer) {
        x = (Integer) phoneNums.getSlot(0);
        y = (Integer) phoneNums.getSlot(1);
        width = (Integer) phoneNums.getSlot(2);
        height = (Integer) phoneNums.getSlot(3);
    }
    else if (phoneNums.getSlot(0) instanceof Double) {
        x = ((Double) phoneNums.getSlot(0)).intValue();
        y = ((Double) phoneNums.getSlot(1)).intValue();
        width = ((Double) phoneNums.getSlot(2)).intValue();
        height = ((Double) phoneNums.getSlot(3)).intValue();
    }
    else {
        return;
    }

    System.out.println("x: " + x + " y: " + y + " width: " + width + " height: " + height);

};
}

An SSCCE of my HTML File:

 <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
        <script type="text/javascript">
        function getWindowRectangle(){

            var winX = (document.all)?window.screenLeft-2:window.screenX;
            var winY = (document.all)?window.screenTop-2:window.screenY;

            var winWidth = (document.all)?document.documentElement.offsetWidth+4:window.outerWidth;
            var winHeight = (document.all)?document.documentElement.offsetHeight+4:window.outerHeight;

            return([winX,winY,winWidth,winHeight]);
        }       
    </script>

    <title>SSCCE</title>
</head>
<body>
    this is an SSCCE
    <APPLET CODE="ch.vrag.web.Sscce.class" name="SSCCE" codebase="scripts" archive="Sscce.jar" width=0 height=0 MAYSCRIPT >
    </APPLET>
</body>

This works great exept in Internet Explorer 6. There I have this Java Exception:

java.lang.Exception: netscape.javascript.JSException: Unknown Name

what is this Exception good for? What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:10:24+00:00Added an answer on June 5, 2026 at 3:10 am

    The Internet Explorer 6 seems to have a Problem with the getSlot() command, but I could use a Workaround.

    with this Object:
    JSObject phoneNums = (JSObject) window.eval("getWindowRectangle()");

    I can get a String out of phoneNumbs (phoneNums.toString();) this String gives me my return values in this form:

    “number1,number2,number3,number4”

    so I can split the string and get the numbers I need.

    The moral of the story is, that Internet Exlorer 6 is not no contemporary and should not be used any more!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to call javascript method from an Applet using netscapte.java.JSObject . in
I am using a JavaScript to Applet object called JSObject and I get from
It is possible to access HTML DOM from an applet using netscape.javascript JSObject API.
Can I pass a string from Java to my C++ routine using JNI function
I'm using getAppletContext().showDocument(new URL(javascript: + command)); to call javascript from applet. But sometimes in
I am using a signed java applet to load an image from the filesystem
Using the javascript function function squareIt(number) { return number * number; } When given
I'm having trouble getting a Java Applet to communicate with the Javascript code on
I want to send Hangul (Korean symbols using UTF) text from C to JAVA.
This is my Search Object: package models.helper import play.api.libs.json.Format import play.api.libs.json.JsValue import play.api.libs.json.JsObject import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.