When Java applet invokes JavaScript which executes window.showModalDialog, get popup with about:blank

When using a Java applet that invokes a Javascript function that in turn calls window.showModalDialog, a pop-up dialog that only contains "about:blank" results. Selecting "show desktop" from the Windows 7 taskbar and then viewing the FireFox window results in the true dialog content being displayed. Everything worked properly until very recently (and old versions of FireFox work) and I suspect something was changed in FireFox as a result of the recent Java security failures.

Hello, I don't know about this specifically but this is what I would try.
Instead of the string "\u7834\u70C2\u7269\u7A0B\u5E8F\u5458..."
Set the encoding type in the String constructor first...
ie:
new String( "\u7834\u70C2\u7269\u7A0B\u5E8F\u5458...","GB18030");
Here is a little class I whipped up to show the CharSets that are available to you..
public class ShowAllCharSets
ShowAllCharSets()
Map myMap = Charset.availableCharsets();
Iterator iterator = myMap.keySet().iterator();
   while (iterator.hasNext())
      System.out.println("Char set name = "+((String)it.next()));
public static void main(String args[])
   new ShowAllCharSets();
}Then use the preset charset String with the specific encoding already set for your menu items.
GB18030 I picked arbitrarily because it is Chinese and you may have to try another.
Good Luck!
(T)

Similar Messages

  • Java Applet to Javascript Communication

    There is a Java Applet which digitally signs files after taking
    private key from a smart card.This applet takes external files.
    I want to do this "Generate digital signature of a web page with the
    help of an applet of which the applet is itself a part"
    I am trying using Java Applet to Javascript Communication.
    I am able to access the object which represents the HTML document.
    That abject is represented by document itself.
    Now I have to somehow generate the whole webpage i.e. like we view in a
    notepad like this:
    <HTML>
    <Title>my page</title>
    Then write into a file and then that file can be signed.
    This is what I feel.
    In C#.net there is a method .innerhtml.
    Does such kind of a method exists in Java.???
    I m searching but cudn't get till now.
    Will serialization work??

    Kindly forget the previous post. Read the following:
    JSObject browserWindow = JSObject.getWindow(this);
    JSObject doc = (JSObject)browserWindow.getMember("document");
    Here doc represents the object of the HTML document.
    This is accessed using Java Applet JavaScript Communication.
    I want to serialize the object represented by doc.
    Then write it into a file and generate it's digital signature.
    In the below written line the parameter fileName is passed.
    CertificationChainAndSignatureBase64 signingResult = signFile(fileName);
    For this I have added few lines in the code written below.
    see first 10-30 lines. Though this code gets compiled but it is not running. When I want to sign the file , it throws an error
    "Unexpected error:sun.plugin.javascript.ocx.JSObject"
    This code is just one class. Two other classes are needed to completely test the code.
    Should I post them ??
    Kindly see what is the error.
    I will be highly grateful and Sorry for confusing in the previous mail...
    private void signSelectedFile() {
    try {
    // Get the file name to be signed from the form in the HTML document
    JSObject browserWindow = JSObject.getWindow(this);
    JSObject mainForm = (JSObject) browserWindow.eval("document.forms[0]");
    String fileNameFieldName = this.getParameter(FILE_NAME_FIELD_PARAM);
    JSObject fileNameField = (JSObject) mainForm.getMember(fileNameFieldName);
    //This is another modification
    //String fileName = (String) fileNameField.getMember("value");
                   //here we get the document......
    JSObject doc = (JSObject)browserWindow.getMember("document");
    //String docum = doc.toString();
    String thePage = "as";
                   FileOutputStream out = new FileOutputStream(thePage);
                   ObjectOutputStream s = new ObjectOutputStream(out);
                   s.writeObject(doc);
                   String fileName = thePage;
                   JOptionPane.showMessageDialog(this, fileName); //"Unexpected error: " + e.getMessage());
    // Perform the actual file signing
    CertificationChainAndSignatureBase64 signingResult = signFile(fileName);
    if (signingResult != null) {
    // Document signed. Fill the certificate and signature fields
    String certChainFieldName = this.getParameter(CERT_CHAIN_FIELD_PARAM);
    JSObject certChainField = (JSObject) mainForm.getMember(certChainFieldName);
    certChainField.setMember("value", signingResult.mCertificationChain);
    String signatureFieldName = this.getParameter(SIGNATURE_FIELD_PARAM);
    JSObject signatureField = (JSObject) mainForm.getMember(signatureFieldName);
    signatureField.setMember("value", signingResult.mSignature);
    } else {
    // User canceled signing
    catch (DocumentSignException dse) {
    // Document signing failed. Display error message
    String errorMessage = dse.getMessage();
    JOptionPane.showMessageDialog(this, errorMessage);
    catch (SecurityException se) {
    se.printStackTrace();
    JOptionPane.showMessageDialog(this,
    "Unable to access the local file system.\n" +
    "This applet should be started with full security permissions.\n" +
    "Please accept to trust this applet when the Java Plug-In ask you.");
    catch (JSException jse) {
    jse.printStackTrace();
    JOptionPane.showMessageDialog(this,
    "Unable to access some of the fields of the\n" +
    "HTML form. Please check the applet parameters.");
    catch (Exception e) {
    e.printStackTrace();
    JOptionPane.showMessageDialog(this, "Unexpected error: " + e.getMessage());
    }

  • The application maps is not working. When I try to run it opens for a few seconds with a blank screen and then closes

    The application maps is not working. When I try to run it opens for a few seconds with a blank screen and then closes.

    Try a reset by pressing the home and sleep buttons until you see the Apple logo, ignoring the slider. Takes about 5-15 secs of button holding and you won't lose any data or settings.

  • HT5622 When I try to purchase in my games I get a message about "enviroment: sandbox", and I can't buy anything.  Why?

    When I try to purchase in my games I get a message about "enviroment: sandbox", and I can't buy anything.  Why?

    Not good !
    Same happend to me for an huour ago.
    I don´t no  the resens, my account are no wrong
    and money existing.
    What can they more wish ?
    I don´t think it can help to register a new account.
    Because you have same name and ID:nr
    If you like, tell me whats happend after 4 oct to now

  • I can't get a capital c when I press the shift key, but I can get one with the with the caps lock key.  Help

    I can't get a capital c when I press the shift key, but I can get one with the with the caps lock key.  Help

    Hi
    How its going?
    I understand that you are not able to get the capital letter c.
    I want you to change the keyboard and if you have got the warranty please replace at no charge.
    Chetan

  • Java Applet vs JavaScript

    Trying to find pros and cons for Applet and JavaScript. Anyone know any or a good place to look?
    Thanks

    I suppose it depends on what you ultimately want to see. In many ways (many) JavaScript and Applets are not comparable. And you can use Javascript with Applets and vice versa. I have a web application I work on that uses lots of JS with DHTML and it also communicates with an applet, and the applet calls JS stuff as well.
    Trying to use JS/DHMTL for very complex GUIs is going to be slower performance then an applet, but probably faster download/start time. Applets also should be using the Java Plug-in which the user would have to pre-install. Netscape 7 has no built-in JVM anymore, and the built-in ones in Netscape 4.7 and IE are both old (JDK 1.8) and buggy.
    I agree with your advantages. As for the disadvantages:
    1. For non-programmers learning curve can be steep.Who is the target user? A developer? The client browser user wouldn't care about this.
    2. Not standard support for Javascript across browsers esp. DOMYes, however, if you can restrict people to IE6 and Netscape 7, then you will find that the differences are minimal. Nothing at all like the difference between them and Netscape 4.7. I'm not up on the latest Opera's support, however.
    3. Web page useless if script does not work!!"does not work" sounds like a development problem. Good, correct code will work.
    4. Javascript may be disabled by browser reading HTML file no control over thisYes, but if you A) have proper checking you can be sure it's enabled, and B) applets can also be enabled.
    5. Anyone can see the JavaScript source code by viewing the
    HTML document source. Thus you could not create a secure
    multiple-choice test in JavaScript; it would be very easy to
    see the answers!While this is generally true, you can do some tricks to solve that type of problem. Lets take this example. You can find Javascript code for creating MD5 hashes, and you can then use that to store the hash of the answers in the page and use the MD5 code to compare the given answers to the real ones. This type of thing is not good for all, of course.
    6.Even though JavaScript is a standard, different browsers
    interpret JavaScript differently, and some commands that work
    fine on one browser simply do not work on another. You must
    carefully test your JavaScript code on all browsers to make
    sure it runs correctly.This is basically the same type of problem as #2 above, and I would give the same answer. Ultimately, you have to limit yourself to certain browsers/versions. But if the user wants to see it, there's little you can do.
    As Sue said, Flash is pretty robust and more secure, since it's easy enough to decompile applets. And server side things would be better security as well, if that's a big issue.

  • Comp. shuts down when java applet is on.

    Hi,
    My comp. shuts dowm app. after 5 minutes when i load a jave applet.
    I have jdk 1.3.1_04 .
    Any help/?
    Thanks
    Ophir

    sure its java related. Could be that your PC PSU is too low in Wattage, a windows driver problem. Also try upgrading to java 1.4.1 ?
    Tom

  • Java Applets (facebook) too "big" for window borders...?

    My java applet on facebook extends beyond the set borders. How can I make this smaller?
    Here's a picture of what it looks like:
    http://img2.pict.com/57/60/e6/0e4f69d546c2eacf750d516f09/K5pnb/yeddes.jpg
    I'm using Firefox and I have the latest versions of both Firefox and Java.

    Interestingly enough, the preferredLayoutSize method of the layout manager attached to the JScrollPane never gets called when the scroll pane is resized horizontally, only vertically. I found this out by subclassing BoxLayout so that it printed a string when certain methods were called. I did that after noticing that I can resize your help window vertically with no problem, but horizontally is a different story -- when I increase the horizontal size, the JPanel grows to fit, but when I decrease the horizontal size, the JPanel stays the same size. Returning smaller Dimensions in preferredLayoutSize of my overrided BoxLayout class didn't help.
    I investigated further and subclassed JPanel to print a message when setSize or setBounds was called. When I vertically resized the help window, JPanel.setBounds was called to resize the JPanel. I was expecting that. However, when I horizontally resized the help window, the JPanel size wasn't updated... at least not in the way I expected it to be. When I increased the horizontal size past the maximum horizontal size so far, the JPanel's horizontal size was increased to match. However, when I decreased the horizontal size, the JPanels horizontal size was not decreased to match.
    So, here's what I found:
    1) JScrollPane vertical size increased: Scrolled component vertical size increases to match.
    2) JScrollPane vertical size decreased: Scrolled component vertical size decreases to match.
    3) JScrollPane horizontal size increased: Scrolled component horizontal size increases to match.
    4) JScrollPane horizontal size decreased: Scrolled component horizontal does not change.
    So the scrolled component horizontal size gets increased, but never decreased. This is odd... perhaps it is a JScrollPane bug? I'll see if I can't figure out a way around it. Overriding the scroll pane's setBounds and setSize methods didn't work, perhaps I'll target the JViewport next.
    Sorry I couldn't help right away, though. Lemme know if you figure it out.

  • Java Applet call javascript problem

    Hi I have a web page as follow and embedded a applet. The applet call the java script, and instead of showing an alarm, the browser show the javascript code. Is that strange ? Any suggestion for this problem.
    HTML:
    ================================================================
    <HTML>
         <HEAD>
         function ShowEmbd()
              alert("Test Applet call Javascript");
         </SCRIPT>
         </HEAD>
         <BODY>
         <FORM NAME="AppletEmbdStart">
              <OBJECT classid="clsid:48B2DD7B-6B52-4DB0-97C9-ECB940113B47" id="CIVON_DEmbdObj" width="0" height="0"></OBJECT>
              <APPLET code="MyApplet.class" width="0" height="0"></APPLET>
         </FORM>
         </BODY>
    </HTML>MyApplet.java
    =========================================================================
    import netscape.javascript.*;
    public class MyApplet extends javax.swing.JApplet
         private JSObject m_win = null;
         private JSObject m_doc = null;
         public void init()
              getJSWin().call("ShowEmbd", null);
         private getJSDoc()
              if(m_doc == bull)
                   m_doc = (JSObject) getJSWin().getMember("document");
              return m_doc;
         private JSObject getJSWin()
              if (m_win == null)
                   m_win = netscape.javascript.JSObject.getWindow(this);
              return m_win;
    }The page was load and it should call the applet MyApplet. The MyApplet should do the init() method and call the Javascript "ShowEmbd()", BUT, instead of show alert from ShowEmbd(), the browser show the code of ShowEmbd() itself ...... It did not run the javascript and shows the alert ??
    The browser shows a message from status bar "The applet not initial" ???? why ???
    Can anyone help ?!

    On first look:
    I am not sure about the Object Tag, but the Applet Tag requires the MAYSCRIPT attribute before Java can call Javascript.

  • Can't execute windows command in servlet with JDK1.5 and tomcat 5

    Hi all,
    I have a web application which uses a servlet to execute windows commands, such as "mkdir", "mv", and "rmdir". In my servlet, I use java Runtime() class to implement the execution.
    Under jsdk1.4 and tomcat 4, it is fine for the servlet to execute those command. But uncer jdk1.5 and tomcat 5, it gives the following error:
    error to execute a command: java.io.IOException: CreateProcess: mkdir c:\m7q28 error=2
    java.io.IOException: CreateProcess: mkdir c:\m7q28 error=2
    Please help me if you have any idea. Thanks.

    And be sure to read this:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Javascript openDoc not working. All I get is a new window with about:blank in the address bar.

    I have my resume posted in a website applitrack.com. I can upload PDFs. The PDF file shows up as a link and when I mouse over the link, the status bar shows javascript:openDoc('file', '18292'). When I click the link, I get a new window and "about:blank" in the address bar. This website works fine in IE (the PDF gets launched when I click the file link.
    I tried disabling and uninstalling AdBlock Plus and that didn't help.

    There have been reports of the PDF plugin not working correctly with Firefox 5.
    It may help to change the setting for PDFs here:
    orange Firefox button ''or'' Tools menu > Options > Applications
    I think some people have had luck resetting their download actions as described in this article: http://kb.mozillazine.org/File_types_and_download_actions#Resetting_download_actions

  • When I open a New window the window doesn't open with a blank page, it opens with my start-up page!

    When I open Firefox, it opens to pages I was on when I last closed it. After that, when I open a brand new window, and I don't use a link, it isn't a blank page but instead it shows the same pages as when I started up Firefox. I don't need two windows of the very same pages! I have to delete one of two of the duplicated pages and then my url into the bar to get to the page I want. I want to have a new window with a blank page

    It is the default action in Firefox to open a new window with the home page(s).
    A possibility to avoid that is a bookmarks (e.g. on the Bookmarks Toolbar) with the location set to about:blank and use Shift + left-click to open a blank window or set the Home page to about:blank and use a bookmark to open the home page.

  • When trying to download ipodreset utility for windows i get a message that says the installer is intended for 32-bit version for windows. what can i do next?

    when trying to download ipod reset utility for windows i get a message that the installer is intended for 32-bit version of windows. what can i do?

    I assume you have tried everything here?
    iPod: Cannot restore or update in iTunes with error 1415, 1417, 1418, 1428, 1429, 1430, 1436, or 1439
    It doesn't mention 1442, but the same troubleshooting applies.
    It wouldn't hurt to also try another available USB port on your machine and another sync cable if possible.
    Lastly, try restoring the iPod on another PC or Mac running iTunes.
    If you know of somebody with a PC running Windows XP still, ask them if you can download the reset utility and use it to reset the Shuffle.
    B-rock

  • My mail, which used to work, comes up with a blank page, with no escape.i no longer connects to to the internet as it once did.

    My email, which used to work, now comes up with a blank page, with no escape.

    Wayne-
    Can you get back to the home page?  If so, double click on the Home button and a row of recent Apps will line up along the bottom of the screen.  Scroll across and look for the Mail icon.  Press and hold on it until it starts to wiggle.  A red minus sign should appear on each icon.  Press the minus sign on the Mail App to remove it from the list of recent Apps.  This will stop it from running in the background.
    If you can not get back to the home page, try to reboot the iPad.  Hold both the Home and Sleep buttons for several seconds until the Apple logo appears.  Ignore the "Slide to power off" arrow.  The iPad should restart in a couple of minutes.
    Fred

  • How do I integrate Java Applet and JavaScript?

    Hi:
    This has been asked before, I have read the archives, yet I'm still left with some doubts, and some posts are VERY old and may not apply today. (sorry, some questions might seem stupid, this is my first applet). The purpose is to create a light weight application for managing certificates stored on a smart card, requesting certificate renewal from a server and installing the issued certificate on the card.
    I need to create an applet (signed) to bridge the gab caused by the security limitations of JavaScript in order to access the smart card on the client. The applet will manage certificates on the card and do client-card interaction, while all client-server and user interaction is done by AJAX/JavaScript.
    So, the applet is actually supposed to be an invisible object embedded on the page that is accessed by the JavaScript. How do I go about this?
    - is there any reason to prefer JApplet over Applet?
    - do the JavaScript need to invoke start() or init() or is this done on page load?
    - are there limitations on data exchange with the applet (ie. only string types)?
    - how do I throw exceptions from the applet to the calling script?
    and: will is it better to let JavaScript do all http to keep the applet light, or to let the applet fetch files given a URL (to fetch the new certificate)?
    If the applet is stored in a jar-file, how do I indicate which class/method to invoke? Do the JavaScript have access to public methods only?
    Thanks for your advice and suggestions,
    Erik

    Hi,
    Are you still interested?
    I can work with you over this.
    Adil

Maybe you are looking for

  • How can you get a transport back

    I did the following. I did not have my routes set up in stms I released some tranports How can I get these tranports back into any of my systems. Thanks

  • Can you use V. Ipod on 2 computers?

    Hey guys and thanks for looking at this question. My question is, I have 2 computers, Is it possible to upload songs from both computers into my video ipod?? Thanks in advance for the reply

  • Problem connecting database

    after some time my system show message ('Oracle Shutdown or intializaion is in progress' is there is any solution for this problem because i have to install new windows to rectify this problem so kindly help me out regards

  • Calling ringtones from the application

    Hi guys. I am searching about to getting ring tones of iPhone for application. In other words, user can choose ringtone from iPhone Ringtone list. In order to do that, what do I need to use what class ? Do you have an example related this issue ? Ple

  • Difference between web server and presentation service

    Hi, Can anyone please help me in getting the answer following query: What is difference between the presentation service and a web server? OR If we have a presentation service then why do we require a web server? Thanks & Regards, Satej