Opening browser windows from applet

I have 2 questions
1) Does anyone know, what do I have to do to force my java applet to open new browser window with specified url ?
2) Is any java class, which renders HTML files ? I'm trying to open some document in frame inside applet and I don't know if i have to write this renderer by myself.

for your second question, I dont know if there is a specific HTML class but SAXParser makes reading xml very easy and you probably should have much trouble writing a class to read html.

Similar Messages

  • Getting hang/crash problem when I try to close browser window from applet

    I have a small Apllet that has a button that calls a Javascript function in the opening window, to close the window in which it is loaded.
    The Applet window is a PopUp window from one of my application's window. First time I start my application and load that Applet the button works fine. It calls the Javascript method and the Method closes the window using the self.close() method.
    But now if I open the applet window again and click on the button to close the windows, it hangs. I put in trace statements and saw that it hangs on JSObject.getWindow() window.
    I am using JDK Plugin 1.4.2_07 and 5.0 , if I work out on IE browser, it works fine.But when I use firefox or mozilla it gives problem of hanging/crashing.
    Note that in case of 1.4.2_07 this problem experienced some times but in case of 5.0 it gives always for other than IE browser.
    Please, if somebody could give me some clue about why this would happen, I will really appreciate that. and code related to this is given below
    import javax.swing.JApplet;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import netscape.javascript.JSObject;
    public class TestApplet extends JApplet implements ActionListener{
    protected JButton closeButton = null;
    protected JSObject win = null;
    private JFrame frame = null;
    private boolean alreadyClosed = false;
    public void init(){
    this.win = JSObject.getWindow(this);
    this.closeButton = new JButton("Close Browser Window");
    this.add(this.closeButton);
    this.closeButton.addActionListener(this);
    frame = new JFrame("Test Frame");
    frame.setSize(300, 400);
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.out.println("windowClosing");
    alreadyClosed = true;
    TestApplet.this.stop();
    frame.show();
    public void actionPerformed(ActionEvent ae){
    stop();
    public void stop() {
    if (!alreadyClosed) {
    alreadyClosed = true;
    frame.dispose();
    closeLaunchedBrowser();
    System.gc();
    System.runFinalization();
    private void closeLaunchedBrowser() {
    final TestApplet thisObject = this;
    Runnable r = new Runnable() {
    public void run() {
    try {
    JSObject win = (JSObject)JSObject.getWindow(thisObject);
    if (win != null && win.toString() != null) {
    //win.eval("top.opener=self;self.close();");
    //win.call("close", null);
    win.eval("self.close();");
    } catch (Exception e) {
    Thread t = new Thread(r);
    t.start();
    Thanks.

    I am waiting for any reply. I have tried for all these below options still I am getting Problem. I heard this is because of javascript, it wont call methods more times .Thats
    why I need other than JSObject or java script solution.If some one know anything about this or any modifications I have to made for the below options to avoid that problem please let me know.
    // URL durl = new URL(thisObject.getCodeBase(), "test/CloseMe.htm");
    // System.out.println("URL :" + durl.toString());      
    // thisObject.getAppletContext().showDocument(durl);
    //     thisObject.getAppletContext().showDocument(new URL("javascript:window.close();"), "_self");
    //win.eval("top.opener=self;top.close();");
    //win.call("close", null);
    //Object[] args = { "close", new Integer(50) };
    // win.call("setTimeout", args);
    //win.eval("setTimeout("close", new Integer(50));");
    If it is the problem of JRE I just need it should work on 1.4.2_01 or higher.
    thanks.

  • Opening new window from applet does not pass session

    I have an applet which has a function where it opens some jsp pages in a new window. The jsp page checks for a session variable to very the user is logged in and some other variables that are required on the page. My problem is in IE 6/7 the new window does not have the session variables from the parent window.
    I'm using
    context.showDocument(new URL(host + "?" + params.toString()), "_blank");
    to open the new windows.
    How can I open a jsp age in a new window while carrying over the session variables from the parent/applet window?
    Thanks for any assistance!

    We experienced the same thing with Java 6 Update 18 on IE 7. As for IE 8, if the user is a local administrator, then the session is kept in the new browser windows opened via showDocument. Check out the following URL for related discussions:
    http://stackoverflow.com/questions/1324181/ie8-losing-session-cookies-in-popup-windows
    Our clients are forced to roll back to Java 6 Update 17. Firefox works fine.

  • Opening browser window From Application

    i have an applet that uses the showDocument() method which opens a browser window. I would like to have the same thing happen from my application , but i can not use the applet method showDocument()
    does anyone know how to open a new browser windo using another method?
    Thanks alot for any help cause I have tried to find the anser asnd can not
    ..

    Or use a more cross-platform capable solution such as that found here: http://ostermiller.org/utils/Browser.html

  • Close browser window from applet

    I have a simple applet that is called
    from another application through HTML.
    When the applet is done, I'd like to have
    it exit and close its browser window.
    How is this done? I tried System.exit(),
    and that didn't do it. Neither did
    destroy().

    The only thing I can think of is to have a function defined in JavaScript on your html page and have the applet call the method. For you to be able to do this you will have to have a MAYSCRIPT set in your applet tag.
    IE:
    <script language="JavaScript">
    function closeWindow()
    window.close();
    </script>
    <APPLET code="XYZApp.class" codebase="html/" align="baseline" width="200" height="200"
    MAYSCRIPT>
    </APPLET>
    In your applet:
    Make sure that you import the following.
    import netscape.javascript.*;
    JSObject win = JSObject.getWindow( this );
    win.call( "closeWindow", null );// Calls the closeWindow() on the HTML page.

  • Closing a browser window from applet

    i have applet opened in a IE browser.
    The applet contains TOOL BAR and one of the buttons in it is EXIT.so when i click this exit button the browser window should close.
    if any one has idea about it please let me know along with sample code.
    thanx in advance.

    try this
    on click of that exit button in action event write this
    System.exit(0);

  • Can't open browser window from RoboHelp AIR app??!

    We've got a RoboHelp course that we're exporting as an AIR app using the  Packager and it works great. We've got an embedded flash file that  needs to open a website in a browser window, but, currently it will only  load the site in a new AIR window...any ideas??

    I'm having this same problem also, although you gave me one option in your reply.  I can't get the "Allow" button to work either. I upgraded to Adobe Reader 9.2, and then is when I noticed I couldn't bring up the websites that I usually could before.  I don't really know what you mean about "Stand Alone Option," but I will try to find out.  I also upgraded to Internet Explorer 8, but I'm not sure if this is when the problem started or when I went to Adobe Reader 9.2.
    I used to be able to get "Allow" to work if I opened the document in IE8 and not in AR 9.2, but now that won't even work. I did email the author of a PDF document I was in today in the hopes he would have the answer, but I'm not sure if I got his email address right, so time will tell on that issue.
    I have a "library" of PDF documents, so I would really like to get this problem fixed.  However, I've spent at least two hours on this issue, and I really don't think it has anything to do with Windows Vista incompatibility; I'm pretty sure it has something to do with Adobe Reader, but that doesn't help much given I have emailed support and, of course, have never received an answer.
    I do know there are a lot of people that are having this exact same problem, but no one has an answer to it.  I've tried to do research on this, but I have a lot of "to do" tasks I need to get done every day, so it's not like I have all the time in the world to try and fix this problem.
    I would appreciate hearing from you if you do ever figure this out. My email address is [email address deleted by host] should you find an answer to this very frustrating problem. Warmly, Corinne Larimore [signature deleted by host]

  • How to close Browser window from Applet ?

    I am looking to close the browser window based on an action within applet . any ideas ?

    Hi U can close the Browser window in which the applet
    opened
    try this,
    Just call this where u want to close the browser
    import java.net.*;
    URL url;
    url=getCodeBase();
    try{                    getAppletContext().showDocument (new URL (url+"close.htm"));
    }catch(MalformedURLException e){showStatus("no file");}
    In the close.htm have this code
    ///close.htm
    <HTML><SCRIPT>
    <!--
    window.close();
    //-->
    </SCRIPT></HTML>

  • Opening Browser Window from Hotspot without Browser Toolbars, etc

    Hi Guys
    Can you help please.
    I have a map with some ponds. I've made hotspots for these ponds to open separate pages with some images and info but I really don't need the page to display the toolbars and favorites, etc. I have gone into behaviors and set them to open the browser as I want when I click on the hotspot. Fine. The trouble is it also opens a full browser window as well! Can anyone point me to hoe and where I can set the behaviors so I get only one browser window, without the toolbars, etc?
    Thanks & regards,
    Graham

    Making Pop-Up windows in DW
    http://alt-web.blogspot.com/2010/02/making-pop-up-window-in-dreamweaver.html
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com

  • Open a new browser window from applet

    Anybody know how to open a new Netscape window by pressing a button in an applet? Which class handles it?
    Thanks a lot.
    wz

    http://forum.java.sun.com/thread.jsp?forum=54&thread=106906
    http://forum.java.sun.com/thread.jsp?forum=54&thread=272870
    http://forum.java.sun.com/thread.jsp?forum=54&thread=272829

  • Opening  browser window from Java Swing

    Hi
    I am trying to open
    1) a word document on the click of a button from a Java-Swing based application running only on windows based system.
    Currently the code uses 'rundll' and calls 'a.doc'
    it requires that the application be installed and run only from a specific location in the windows' system.
    i would like to modify the code in one of the following ways
    1) open the word doc irrespective of its location and that of the executable jar which is trying to open this file
    2) upload the word document to a website and direct the application to open that webpage on button click, etc
    i believe that the latter may be simple but i do not have any idea about how to go about it
    i would appreciate some guidance about it.

    Hi,
    I was trying to run the code, for embeding the mozilla web browser in my java application which is running at linux fedoracore2. I set all the environment variables, like MOZILLA_FIVE_HOME and LD_LIBRARY_PATH. I can able to compile successfully but if i run the code, i got the error message like this
    Exception in thread "main" java.lang.Error: Untranslated exception
    at sun.nio.ch.Net.translateToSocketException(Net.java:63)
    at sun.nio.ch.Net.translateException(Net.java:79)
    at sun.nio.ch.Net.translateException(Net.java:85)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:61)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:52)
    at org.jdesktop.jdic.browser.MsgClient.<init>(Unknown Source)
    at org.jdesktop.jdic.browser.NativeEventThread.<init>(Unknown Source)
    at org.jdesktop.jdic.browser.WebBrowser.<clinit>(Unknown Source)
    at IEInJava.main(IEInJava.java:8)
    Caused by: java.net.SocketException: Unresolved address
    at sun.nio.ch.Net.translateToSocketException(Net.java:55)
    ... 8 more
    Caused by: java.nio.channels.UnresolvedAddressException
    at sun.nio.ch.Net.checkAddress(Net.java:30)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:115)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
    ... 5 more
    Thats the error.
    I could not find out, where i had made the mistake, i need help. Any suggestion and comments are most welcome. Thanks.

  • How to open browser window from standalone Java Application???

    Is it possible to start Internet Explorer from non-applet application?

    Something like that could maybe help:
    Runtime.getRuntime.exec("iexplore http://www.google.com");
    but it's not platform independent + I couldn't let it work in that way. It only worked with Runtime.getRuntime.exec("c:\\windows\\....\\iexplore.exe http://www.google.com");
    But it's surely not platform independent.
    So the answer is in fact 'I don't know'.
    And if you ask why am I writing all that then, the answer is 'I don't know' too.
    And if you ask why...

  • Open browser window behavior in Mac not working right

    I am simply selecting my text in my html document and then selecting "Open Browser Window" from the Behaviors panel.  I then put in the info for the file I want it to open along with the size, etc...
    When I test it in the browser (Safari) the link works but the rollover features don't show ... it doesn't show as a link in the browser window.  I followed the tutorial exactly and the instructor's browser showed the link as a rollover.  It's driving me a bit crazy.
    I'm using CS5 on the latest version on Mac OS (Snow Leopard).
    I can put up an example if needed.
    Thanks so much for any assistance.
    BC

    All I can tell you is that when you browse to that link URL, you do not see a JPG image, you see this page -
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Apartment Anchor - Free Apartment Locating Service | ApartmentAnchor.com</title>
    <style type="text/css">
    .content {
    width: 400px;
    a {
    font-size: 20px;
    </style>
      <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-25512543-2']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    </script>
    </head>
    <body>
    <div class="content">
    <ol>
    <li><a href="http://apartmentanchor.com/blogs">Houston Apartment Blog</a></li>
    <li><a href="woodlands/woodlands-tx-apartments.html">Woodlands Texas Apartments</a></li>
    <li><a href="clear-lake/clear-lake-tx-apartments.html">Clear Lake Texas Apartments</a></li>
    <li><a href="cypress-texas/cypress-tx-apartments-for-rent.html">Cypress Texas Apartments</a></li>
    <li><a href="river-oaks/houston-river-oaks-apartments.html">Houston River Oaks Apartments</a></li>
    <li><a href="spring-texas/spring-apartments-for-rent.html">Spring Texas Apartments</a></li>
    <li><a href="league-city/league-city-tx-apartments.html">League City Texas Apartments</a></li>
    <li><a href="houston-texas-apartment-search-engine.html">Houston Apartment Search Engine</a></li>
    <li><a href="get-availability-information.html">Get Apartment Listing</a></li>
    </ol>
    </body>
    </html>
    Do you have that page on your site?  Is that your home page?
    Perhaps you have some hidden redirection going on via an htaccess file?  I dunno....

  • Closing browser window from an Applet?

    I've written a series of applets that perform different functions. I placed a button on each applet with the purpose to close the window in which that applet is running. However I don't even know where to start looking to find out how to make my applet close it's own browser window. I know how to open a new browser window from an applet but not vice versa.
    Can anyone help please?
    Mark.

    Right, I sort of tracked down some code that uses getMethods to allow me to invoke a Javascript command. It is not pretty and took a little bit of editing to get to work but it does the job without putting JS stuff into my HTML.
    However it is causing some problems. If I open one of my other applets it will only let me close that window and the previous applets ceases to respond at all. I think this may be because the invoke gets the JSObject which is the window and somehow having more than one applet open in different windows is causing it to get confused and is locking the first window and only responding to the second.
    I have seen a much simpler method that uses:
    import netscape.javascript.*;
    and JSObject to get the window but my compiler complains about the import. Any further suggestions or an example would be welcome as my current solution is a bit limited as you can effectively only have one window open at a time which doesn't suit my needs.
    Many thanks.
    Mark.

  • Open new browser window from a JApplet

    Hi,
    I want to open a new browser window from a JApplet.My first thought was to use the Live Connect technology but it worked only with simple applets not with JApplets.Then i tried it by getting the Applet context (getAppletContext() method) but it still didn't work with JApplet...(it worked with Applet).I believe it has something to do with the applet security but i haven't yet figured it out.
    For example when i call the getAppletContext() method from a JApplet i get an java.security.AccessControlException ... .Thanks

    I must correct myself now :).
    The getAppletContext() method does work with JApplets too.Still , i have problems with the Live connection alternative.It seems that it by importing the netscape.javascript package i get the security eror that i mention above...

Maybe you are looking for

  • How to view database table in oracle9i Jdeveloper

    Hi, how to view database table in oracle9i jdeveloper,any manual setting .please help me. thanks saran.

  • Help required in QM

    Dear All, We have a requirement to get a pop up message for certain parts at the time of GR. So we have used QM procurememt key active & certificate type. which will pop up a message at GR. If QM procurement key is active in material master, during G

  • BlackBerry Protect :\

    Hi,, BB protect doesn't work on my BB curve 9360,, keep telling me " The service plan for your BB does not support this app . please contact your service provider for additional information or to update your service plan " .. so i hope u have an idea

  • Interactive form

    This may not be the right forum for this. If not, I hope someone will point me in the right direction. I have a form that contains several menus the user can pick from. When a user makes a selection, I want the value of that selection to appear in an

  • Import and Package errors (DBMS_RLS security)

    I imported a schema recently, but i users can't log and i found out that dis package that was imported had a problem, and when i try to recompile it gave the error below SQL> show error Errors for PACKAGE BODY SYSMAINT_PKG: LINE/COL ERROR 96/5 PL/SQL