Can applet close the Web browser window it embedded in?

I know that a link or button in the Web browser can close the browser window. But I really don't if the applet can also do it.

This site does have a search function you know, and if thats too much trouble there is google:
http://www.google.com/search?q=site%3Asun.com+%22java+to+javascript%22&ie=UTF-8&hl=nl&lr=
This should point you in the direction of a thing called JSObject
Here is some code since I have this in my archive anyway:
the html file:
     <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
              height="0" width="0" >
        <param name="code" value="someApplet.class" />
        <!--[if !IE]> Mozilla/Netscape and its brethren -->
        <object classid="java:someApplet.class"
                height="0" width="0"
                >
        </object>
        <!-- <![endif]-->
      </object>
<LABEL id="lblOutputText">This text is the HTML text </LABEL>the applet:
// new class for jsObject!!!! compile this: javac -classpath "C:\Program Files\Java\j2re1.4.2_01\lib\plugin.jar" someApplet.java
// since jaws.jar does not exsist anymore
// in 1.4.0 to compile: javac -classpath "C:\j2sdk1.4.0_03\jre\lib\jaws.jar" someApplet.java
import netscape.javascript.*;
public class someApplet extends java.applet.Applet {
    JSObject win;
    public void init() {
         try{
             win = JSObject.getWindow(this);
// you need win.eval("window.close();"); // to close the window. if the current window is not a popup
// opened by a parent with window.open than the user will get a waring, your next question probably will
// be "can I stop this warning" and the answer is simple: NO
             JSObject textBoxLabel = (JSObject) win.eval("document.getElementById('lblOutputText')");
             textBoxLabel.setMember("innerHTML", "<center><h1>Some text</h1></center>");
        }catch(Exception e){
             e.printStackTrace();
}

Similar Messages

  • End-user closes the Web browser's window...

    Hi ,
    I have an Exit_Form selection on a menu.....
    Is it possible the code being there to be executed whenever the end-user closes the web-browser's window.....???
    I use Dev10g.
    Thanks , a lot
    Simon

    Unfortunately... is is not applicable....because:
    1) Many users(application users) connect via a db user to the database.... , so i cannot relate each application user to a db session.
    2) The trigger on_logoff can not be used because of the first note....
    3) As i have written in my previous post the "exit_form" is not 'pure PL/SQL' code but 'forms' code.... It contains some 'erase(global_variables)' which are unknown to the db......
    Thanks , anyway...
    Simon

  • How can I close the iOS Diagnostics window?

    When trying to solve a problem through Apple's support service a iOS Diagnostics app started and now I cant figure out how to close it. It's not in the recently used list of apps, but when I swype through the opened apps, it's always there.
    So my question is:
    How can I close the iOS Diagnostics window?

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
     Cheers, Tom

  • How to close the web browser

    How can I be sure the web browser and all screens are completely closed on the droid 2

    Why is closing the browser important? Are you concerned about battery life?
    To close any app that is running you can go to Settings > Applications > Manage Applications > Running and force stop on the browser.
    It is certainly harder than on PC or MAC platforms, and even on some other smartphones.  At the same time, in many smartphones including Windows Mobile, iPhone, BB and others, the general model is different than computers - the general approach is that well behaved applications in essence are meant to be demanding no CPU when they are not in focus, unless there's some explicit background function like periodically obtaining e-mail and such.
    Certainly this may not always be the case, especially if an app is not coded correctly - but generally the guidelines for developers of smartphone code across multiple platforms discourages having an exit button and instead focuses on how to make sure an app is well behaved and low in demand during expected prolonged periods of dormancy.

  • How can I open the Wndows Browse window from forms..

    I am using forms 5.0 and at run time I want to open the
    MSWINDOWS "BROWSE" window.Can any body help me?.

    I found this example in a book, which is useful for retrieving an
    image file from a local drive and inserting it into a table.
    I hope you find this helpful.
    DECLARE
         v_dirname          VARCHAR2(255);
         v_filename          VARCHAR2(255);
    BEGIN
         v_dirname := 'C:\';
         v_filename := get_file_name(v_dirname, NULL,
              'Bitmap file (*.bmp)|*.bmp|'                    ||
              'JPEG file (*.jpg)|*.jpg|'                         );
         IF v_filename IS NOT NULL THEN
              read_image_file(v_filename, 'ANY', 'av_data_image.blob_data');
         END IF;
    END;

  • How can I customize the opened browser window

    I need to customize the browsers to tell them not to display the address bar or any toolbars. This will be a stand alone presentation that won't connect to the web but use the browser to present. I don't want any browser details. As close to a frame as possible like a pop up window.

    When you post a question and then repost more variations of that question, the threads can grow very confusing.  This one has been answered in one of your other threads.  I am locking it.

  • How to close the web browser already opened by a SAP report?

    Hi all,
    pretty strange question: a report written on an old 46C system "triggers" a web app opening a web link with the predefined browser.
    I've seen many alternatives to open a web page (call method cl_gui_frontend_services=>execute, call method open_browser), but no methods to eventually close the browser and I wonder if it's possible.
    The meaning of this request: the report will probably scheduled, so we'd like to trigger the web app and then close the browser... we are using this unusual method since managing web service calls in our obsolete system seems problematic (we opened a thread in SOA section specifically on the topic... seems it's not possible to do in a "clean" way).

    After trying a bit, I noticed it's not possible since there's no control on the lauched application. Solved using a workaround, thanks

  • Applet crashing the web browser

    Hello group!
    I have just done a simple applet that is embedded in a html.
    Every time I close the html, the browser sends and error report. I am thinking that maybe I should have included a close method into the applet or aomething like that.
    Please, help me because is quite a nuisance to have this problem every time I run the html page.
    public class "name" extends Applet{
    public void init(){
    public boolean action(Event event, Object what) {
    Thanks for your help.
    EBU.

    Hi EBU
    Must to have more info to talk about but consider such details:
    1) customize "stop" and "destroy" methods since there is not a "close" method in Applet class.
    2) use System.gc() to dispose/release unnused objects and variables, should free some memory and memory management is the real problem that causes browser to crash. Remember that win is a bad manager.
    3) Using Sun JVM as default? Try it. There will be no surprise if crash stops.
    4) Make an extra effort and deploy using SWING so you will have better applets in functionality with less system dependency.
    If nothing solves the problem, please detail it as possible, debug it and post new questions.
    Regards.

  • E90 - How can i set the web browser not to be iden...

    Hey guys,
    Just got my E90 and loving it... Posting this from bed, yay!
    I'm wondering if it's possible for the browser on this phone to automatically identify itself as... not a phone?
    I'm on an unlimited data plan, in a city with pretty much 3.5G coverage. Yet it's a little frustrating that most sites I'm visiting get displayed in the stripped down 'mobile format'.
    A big reason for buying this phone was to have full internet access, so I'm a little disappointed on that side so far.
    Solved!
    Go to Solution.

    Unfortunately, the HTTP_USER-AGENT value that the browser sends cannot be changed. It is fixed, and web sites who use it to determine what pages to deliver, may often refuse access to "full" web pages, even if the browser could handle it.
    You can try to use another browser like Opera or Opera Mini, or you could also contact each web site's administrators and ask them to make a more (or less, as it may be) "intelligent" web site.

  • How to display applet in the web browser?

    Hi Just want to ask help. Im making an application and i want to display applet in JSP. The problem is when i run my application there's no display in the browser. I already try to put the JSP and the Java Class with the same folder but still not working. Kindly help me with this one..
    Code:
    <jsp:plugin code="appletImage.class" codebase="applet" type="applet">
    </jsp:plugin>
    With this one i put my class in a package

    I think (correct me if im wrong) that that is the old way to do it i.e. it is now deprecated and that the recommended way now is to use the object tag
    Old deprecated way example
    <APPLET code="Bubbles.class" width="500" height="500">
    Java applet that draws animated bubbles.
    </APPLET>New recommended way example
    <OBJECT codetype="application/java"
            classid="java:Bubbles.class"
            width="500" height="500">
    Java applet that draws animated bubbles.
    </OBJECT>

  • Close Web Browser Window Button.

    Is there a way to create a button that users can click to close the web browser window?  Is it possible to do it through javascript embeded on the button action?
    Thank you.

    Hi Eric
    As I said earlier. Play with JavaScript all you like. Good luck in finding a JavaScript method that will work 100% of the time. I've very doubtful you will.
    The simplest test of JavaScript is the Alert, which you have tried. Often testing JavaScript will fail when testing locally. Sometimes it's because the Flash Security is blocking things. To fix that, click here and follow the instructions.
    As for the slide, it all depends on your Captivate settings. If you want it blanked you can insert an image or something that would cover the background. Nav bar is another story. Probably just have to live with it that way or turn it off if you don't wish to see it. Or maybe insert a caption or image that indicates the movie has finished and to please close the window (since it didn't close automatically).
    Cheers... Rick
    Click here for Adobe Authorized Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Retrieving the Web Browser keystore

    Hello everyone,
    My question is in the subject : How can I retrieve the Web Browser (IE for example) keystore from my signed Applet ?
    Is it possible at least ?
    Thanks for your wisdom.
    S�bastien

    For more information, about the mobile-Forum is like this

  • Programming a close acrobat and browser window button into PDFs

    Hi Everyone,
    We are wondering if you could help us.
    We are creating a Flash site which launches many PDFs, these PDFs launch in Acrobat, either in Acrobat itself or through the browser window plugin.
    We want to be-able to program a close button into the PDF that does the following:
    1. Closes the PDF file
    2. Closes Acrobat
    3. Closes the internet browser window
    Does anyone know how we might do this?
    Thanks,
    Steve
    ps. we have had suggestions that we should of integrated the PDFs into Flash, tthis would have been fantastic, but unfortunately we are now to close to the deadline to integrate this.

    I don't think you can do any of those things from a button embedded in
    a PDF in a browser.
    Aandi Inston

  • How I make the Web Browser Control to display a PDF in Windows 8

    I have an application that run ok in previous version of windows,  Where I can load a PDF file and the web browser control automatically use the Reader OCX of Adobe,, After Install windows 8 and download the reader for windows 8 still get and (X) where the document should be displayed.  I use the following command in my program to force the windows 8 to use the same web browser (10) in my web browser control.
    WebBrowser1.Navigate(DocumentName,"",Nothing,"User-Agent:Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)")
    But still get an  (X). IF I use the URL that is in the property of the (X) and paste in my regular IE10, it open the PDF file.

    Adobe Reader Touch is a Windows Store app and does not install a browser add-on/plug-in for "in-browser" PDF viewing.
    You can either
    Install Adobe Reader XI (desktop app) which installs browser plug-ins for Microsoft IE and Mozilla Firefox
    Use Google Chrome, which has a built-in PDF viewer (enabled by default)

  • What are the KEYstroke(s) used to CLOSE the active tab in the web browser?

    What are the KEYstroke(s) used to CLOSE the active tab in the web browser? I am reluctant to use a mouse where I can use keystrokes, as the mouse is a much slower process. In fact, can I find a list of all key strokes which can be used in Firefox, e.g. ALT+S followed by R (once or more) and ENTER used to restore previous browsing session; or CTRL+F to search for a specific word or term? Thank you.

    http://support.mozilla.com/en-US/kb/Keyboard+shortcuts
    http://www.7is7.com/software/firefox/shortcuts.html
    http://www.mvps.org/dmcritchie/firefox/keyboard.htm

Maybe you are looking for

  • OS X 10.5.6 Junk Mail Folder won't let me see inside

    I posted this question already this morning but the post is now missing.... I need help. I deleted a tabbed folder attached to the junk mail folder without realizing that that folder was the junk mail folder for my account. Now, I can see that there

  • Is there a way to make bookmarks in the video program?

    Hello everyone, I was wondering if there is a way to make bookmarks while watching a movie on my iphone. If not, is there a program that does? I have iphone 4 with IOS 5.01 on verizon Thank You Marco

  • Why Backup database then backup archivelog from time...

    Dear Experts, I found in one of our rman scripts the 2 following statements: backup database; backup archivelog from time 'SYSDATE -8'; It seems to me that a "backup database plus archivelog;" is more simple/accurate instead of these 2 lines as the r

  • OAM An error has occurred! nection refused

    I have problem in the OAM, when I try configurate the Workflow Notification mailer. I have this problem. An error has occurred! nection refused /u01/oracle/TEST/inst/apps/TEST_srvrcotest/logs/appl/rgf/oam [10:11:43:22, 12/16/11] java.lang.RuntimeExce

  • Optimizing jpgs

    I am optimizing images to 10k. The the "Save for Web and Devices" all images are coming up under 10k. Though after I save, in the folder the image says 12k.  What's up?