Close browser

I'm trying to close my browser by clicking on a button. I've tried the following but it does not work for me. I'm using Firefox.
       var urlString:String = "javascript:self.close()";
       var request:URLRequest = new URLRequest(urlString);
       navigateToURL(request, "_self");
Is there a way to close the browser with code in the flex file?

js: window.close() is not allowed to close the main window ( unless it is opened by another window ) in some broswers.
i faced similar need, what i did is just display the blank screen:
navigateToURL( new urlRequest("about:blank"));
i know it is not final solution, but this is what i could do.

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.

  • Close browser window on click  - pass parameter

    Hi,
    I have two applications (iViews) in the portal, one passing parameter to the other. On click of 1st iView, it passes parameters to 2nd iView, which opens as a separate window in portal. I need to select some values in it and on clicking OK, some parameters should be passed to the 1st IView and the window must be closed. The parameter must be made available in the 1st Iview, by autorefreshing.
    Srinivasan T

    Hi,
    I try this and it is work fine
    This solution for IE7 & IE8
    <af:resource type="javascript">
         function closeBrowser() {
             window.open('', '_self', '');
             window.close();
    </af:resource>
    <af:commandButton text="Close Browser" id="cb1" immediate="true">
          <af:clientListener method="closeBrowser" type="action"/>
    </af:commandButton>Sameh Nassar

  • What can i do to regain the function of the close browser button?

    after using firefox for a number of weeks without problems, today the close browser button is not functioning! (white cross on red ground) The only way to close the browser is by using the task manager end task. This is a simple problem but what can I do to fix it? I have tried updating but not reinstalling.I dont have any more details I am afraid, the button just doesnt work. I dont think it is a problem with my computer cos for example 'word' closes as expected. Likewise Internet Ezplorer. More than that I do not have any idea why this is happening.

    That is Close the Window button, not close the browser, and with Firefox that makes a difference because of subtasks.
    The following may not completely eliminate having to terminate Firefox through the Windows Task Manager but it will come very close.
    '''Plug-in and tasks started by Firefox may continue after attempting
    to close Firefox''' The "X" in the upper right-hand corner closes the
    Window (same as Ctrl+Shift+W) but even if it is the last Firefox window,
    it does not necessarily close Firefox .
    The only '''proper way to exit Firefox''' is to use '''Exit''' through the
    File menu, not the "X" in the upper right corner of last Firefox window.
    In the 4.0 and up with the "Firefox" button that would be Alt+F then X
    * '''Firefox hangs''' | Troubleshooting | Firefox Support <br>http://support.mozilla.com/en-US/kb/Firefox%20hangs#w_hang-at-exit
    Use the '''Windows Task Manager''' to remove all running firefox.exe in the "'''Processes'''" tab of the Windows Task Manager, then restart Firefox.
    ''very infrequent --'' If Firefox will still not start, remove the parent.lock file from the profile which is created each time Firefox is started to prevent other Firefox tasks from running, see<br>
    http://kb.mozillazine.org/Profile_in_use#Remove_the_profile_lock_file
    '''Avoiding Problems with close/restart''' ''choose either extension''
    :Use to close and restart Firefox after enabling or disabling an extension, switching to a new theme, or modifying configuration files, then you don't have to worry about delay or have to look in the Task Manager to see if Firefox is closed yet.
    *"'''Restartless Restart'''" extension for Firefox 4.0+ only (2 KB download ) --
    uses keyboard shortcut "'''Ctrl+Alt+R'''" or a file menu option.
    <br>https://addons.mozilla.org/firefox/addon/249342/
    *"'''QuickRestart'''" extension (34 KB download) ''(older extension for those below 4.0)''<br>
    uses keyboard shortcut "'''Ctrl+Alt+R'''" or a file menu option. <br>https://addons.mozilla.org/firefox/addon/3559/

  • How to capture when user closes browser

    I am implementing a scenerio where I need to reset login status in the database to false when a user closes browser without logout. I am at fix, how do I do that ????? With the java script solution, its a browser dependent and may not work with all the browser. With java sessionListener, the sessionDestroyed() method is never called when browser is closed.
    Plz. help... how can I capture the browser closing event. My application is running on Websphere and integrated with active directory for authentication and authorization.
    Thanks in advance......

    SoulTech2012 wrote:
    what about HttpSessionBindingListener?
    javascript solution doesn't sound good to me"hack" was chosen for that reason. Currently, there are no real good solutions for this. The browser runs autonomously from the server so there is not a lot that can be done. HttpSessionBindingListener is intriguing but I bet when the browser is x'd out of there is nothing sent to listen to.
    The first reply "reasonable timeouts" is the most relied on solution. All others are a lot of work for iffy pay back at best. This is one of the issues that has forced me into rather strict no session solutions.

  • Call JavaScript when user closes browser containing webcenter

    Hi
    Scenario:
    1. Webcenter is opened in a browser.
    2. User closes the browser
    Requirement:
    - When user closes browser containing webcenter, a java script (or a servlet) should get called.
    As you know, we can call a script in 'onunload()' of body tag.
    But how do we call it with webcenter?
    Thanks.
    Edited by: 873687 on Dec 14, 2011 5:34 AM

    Here is a few links that I found for the JavaScript side you might play aroudn with.
    http://developer.irt.org/script/1230.htm
    http://www.webreference.com/js/tutorial1/reference.html
    http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20953676.html
    http://www.devguru.com/Technologies/ecmascript/quickref/window.html
    And two in German
    http://www.uni-magdeburg.de/service/www/books/muenz/javascript/objekte/window.htm
    http://www.exine.de/clientseitig/js_work_events.htm

  • IPad closes browser for no reason

    When trying to use browser iPads closes browser for no reason

    The iPad didn't close the browser rather the browser encountered som internal error and was forced to quit (i.e., a browser bug). Sometimes these errors can be caused by the browser running out of memory.
    Sometimes a particular web site will expose a browser bug causing it to crash frequently (or always) when visiting that site.
    Report these problems to Apple with site information when encountered:
    http://www.apple.com/feedback/ipad.html

  • Express install always asks user to close browser window

    Is Adobe in charge of the code that closes browser windows at
    the end of express install?
    I'm currently using SWFobject 1.5 to embed my flash movie
    with express install active and neither IE6, IE7 or firefox will
    automatically close once express install has finished. It used to
    be that IE would close and reopen the window, firefox never used to
    but that's a different topic I'm sure.
    Perhaps Adobe changed something?

    Never mind, found the answer here:
    Re: Closing brower window

  • How to close browser window after user log out

    Hi,
    Does anyone know how I can close browser window after user logs out. The scenario is when user clicks a log out button I will invalidate user session and close the browser right away in the backing bean.
    Your help would be appreciated.

    Try run this and you'll see that it runs fine with no exceptions:
    <%
         String someText = "bla bla bla";
         response.setContentType("text/plain");
         response.setHeader("Content-Disposition", "attachment;filename=message.txt");
         try {
              ServletOutputStream os = response.getOutputStream();
              os.write(someText.getBytes());
              os.flush();
              os.close();
         } catch (Exception e) {
              out.println("ERROR: " + e);
    %>It looks like that after I've closed the outputStream I can't do any more processing in the JSP. Even if I remove the setContentType and setHeader methods it still behaves this way.
    I'm starting to think that there's no way around this...??

  • Close Browser window when you close 10g forms

    Help Please.... I am trying to close browser window when I exit 10g forms:
    Per oracle Note:115905.1
    create close.html file Put the html file in the webserver root.
    I created the following file in $ORACLE_HOME/Apache directory (webserver directory??)
    1.)Create an html file (es. close.html):
    <html>
    <body onload="closeit()">
    <script>
    function closeit()
    win = top;
    win.opener = top;
    win.close ();
    </script>
    </body>
    </html>
    In exit form when button pressed I have the code
    web.show_document('http://apphost1.univ-wea.com:7777/close.html','_self');
    The brwser window does not close automatically.
    thanks,
    Anitha

    Hello this is saras from chennai.
    Now i m developing oracle forms using 6i. now i m running it independantly. that is i put forms in one folder and run these forms using shortcut. If i m using the same in client machine also. But now i want to run these forms in webbrowser(client-server). for this i done the followings.
    1. installing forms server and reports server.
    2.Also i install IIS Server and appachie server also.
    3. I had fmx files.
    now i dont know the procedure to configure these web server with forms server. And i hold the fmx files in inetpub\wwroot folder.
    Which one is the easy method appachiee server or iis server.
    Please help me to run these fmx files in web browser.
    I m eagerly waiting for your favourable reply.
    saras,
    [email protected]
    chennai

  • Possible solution to close browser issues.....but am not sure how to acheive it

    Hi there,
    In an earlier post I was and still am having issues with the close browser window, but now I have thought of a solution that will do the job if I can get CP to mimic key strokes on a button press/click or using advanced actions, but I am not sure how to achieve this....
    The idea is to have the ALT-F-X keyboard combo done when a button is clicked, which will then close the browser....
    Does that sound achievable??
    Cheers
    Rossco

    You can download CS5 from this site
    Download CS5 products

  • Unable to close browser when using Adobe Interactive Form

    Hello,
    I'm using an Interactive Form in my Web Dynpro application. Everything works fine, but when the view with the Interactive Form is active, I am not able to close the browser window anymore. Moving to another view is also not possible.
    I already changed all the options of the Interactive Form but always the same behaviour.
    I am developing on Web AS 6.40, Service Pack 11. ADS is installed also with Service Pack 11.
    Adobe Reader is Version 7.0 and Adobe Designer is Version 7.1
    Has anyone an idea what's wrong?
    Thanks for your help!
    Best regards
    Christian

    Hi,
    I am facing a problem with viewing SAP interactive forms.
    I have the SAPForms.api in Adobe reader plugins but is outdated (19th apr, 05). How do I get the new one and how do I register it ? This same scenario works on a colleague's machine with same config except the SAPForms.api which is latest. (Nov, 05)
    Any pointers will be highly appreciated.
    Thanks,
    Samar

  • When downloading a large PDF file, firefox stops after some of file and hangs up. Only way out is to close browser or power down. Internet explorer will complete download of same PDF file.

    For example, go to irs.gov and try to download 1040 instructions as a PDF file. Firefox hangs up after part of the file is downloaded, but will not complete the download. The only way out is to close the browser (Firefox). Sometimes the only way out is to power down computer and reboot. I'm running Windows XP Professional. My computer has plenty of memory and disc space, so that is not the problem. When I use Internet Explorer (UGH!) it takes a while, but the very same pdf file will completely download.

    For example, go to irs.gov and try to download 1040 instructions as a PDF file. Firefox hangs up after part of the file is downloaded, but will not complete the download. The only way out is to close the browser (Firefox). Sometimes the only way out is to power down computer and reboot. I'm running Windows XP Professional. My computer has plenty of memory and disc space, so that is not the problem. When I use Internet Explorer (UGH!) it takes a while, but the very same pdf file will completely download.

  • Applications closes browser when using firefox.

    I've installed firefox and I'm trying to access applications, but when the initial menu is displayed the browser closes.
    I also tried using the following url :
    http://<hostname:port>/dev60cgi/f60cgi
    and the same thing is happening.
    Has anyone seen this before or have any suggestions?

    Is the problem occurring on the Forms front end, or web? Is JInitiator installed on your client?
    If Firefox is crashing on you when you try to open Forms, then try installing JInitiator via Internet Explorer first. I found that Firefox is a bit picky when installing plugins... I could not get mine to download Jinitiator as it did not like the fact thet it was "Unsigned".
    Once I installed Jinitator though, I managed to open up Forms from inside Firefox.
    Hope that helps
    B.

  • Close browser button

    Hi there.  Is it possible to add a button in adobe presenter to close the browser window.  I want to launch the e-learning in full screen but once i do so i can easily close the window.
    We have a bit of e-learning done by someone else which has this functionality but the scorm files consist of HTML files not SWF files so I wonder if this causes a problem.

    Sam,
    Create a button in a region position, name and label the button and choose
    "Redirect to URL without submitting page" as the action.
    When you reach the branching part of the create button wizard, choose "URL" as the target.
    fill in "javascript:window.close()" as the URL target.
    Maarten

  • Session does not end even when i close browser

    when i close firefox/IE the session continues ,What i need is that i am adding amount in shopping cart ,but the amount adds to old amount even when i open a new browser window ,
    i hv checked that my browser will remove cookies when i will close mozilla
    i hv also printed total=0 in servlet's ini method but the init method is called only once and total does not reset to 0,does 'th the call to init method is made everytime we start a new session via browser ,it does not get called whn i close the current browser and open new one.how to destroy the older servlet?
    I m using s=request.getSession()
    and s.setAttribute("billamnt",total)
    the code of the servlet is
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class addtocart extends HttpServlet
         HttpSession s;
         PrintWriter pw;
         int total,cam,mob;
         public void init()
              total=0;
              cam=0;
              mob=0;
              System.out.println("inside  cart init");
    public void service(HttpServletRequest req,HttpServletResponse res) throws IOException
         s=req.getSession();
        res.setContentType("text/html");
         pw=res.getWriter();
         pw.println("<html><body><a href="+"mobs"+">Mobile</a><br><a href="+"cams"+">Camera</a><form method = "+"post "+"action ="+"bill"+"><br><input type= "+"submit"+"></form></body></html>");
        if(req.getParameter("csony")!=null)
        cam=cam+Integer.parseInt(req.getParameter("csony"));
        if(req.getParameter("clg")!=null)
        cam=cam+Integer.parseInt(req.getParameter("clg"));
        if(req.getParameter("cnokia")!=null)
        mob=mob+Integer.parseInt(req.getParameter("cnokia"));
        if(req.getParameter("cerricson")!=null)
        mob=mob+Integer.parseInt(req.getParameter("cerricson"));
        s.setAttribute("cambill",new Integer(cam));
        s.setAttribute("mobbill",new Integer(mob));
        s.setAttribute("billamnt",new Integer(cam+mob));
    public void doPost(HttpServletRequest req,HttpServletResponse res)
    public void doGet(HttpServletRequest req,HttpServletResponse res)
    }Wats the problem?
    Message was edited by:
    pooja_k_online

    The servlet is not created on a session basis. All users share the same servlet object. The servlet is created once when the servlet is first called in the context, then is maintaned until the server shuts down.
    You should not store any state in the servlet. You should use the HttpSession object you get from the request object to store the totals, and all other values. You should not use the servlet to hold on to a session object, as multiple users would see the SAME session that way. If you need to use the session in multiple methods, then you should pass that object as parameter, not by making it a class member.
    You also shouldn't put the work in the service method of the HttpServlet. You should put it in either the doGet or doPost method (and if you want to make it happen for both type requests, call doPost from the doGet method and put the work in the doPost method).
    For example:
    public class ShoppingCartServlet extends HttpServlet {
      public void doGet(HttpServletRequest request, HttpServletResponse response) {
        doPost(request, response);
      public void doPost(HttpServletRequest request, HttpServletResponse response) {
        HttpSession session = request.getSession();
        Integer cambill = (Integer)session.getAttribute("cambill");
        int cam = 0;
        if(cambill != null) cam = cambill.intValue();
        Integer mobbill = (Integer)session.getAttribute("mobbill");
        int mob = 0;
        if(mobbill != null) mob = mobbill.intValue();
        Integer billamnt = (Integer)session.getAttribute("billamnt");
        int total = 0;
        if(billamnt != null) total = billamnt.intValue();
        String csony = request.getParameter("csony");
        if (csony != null) cam += Integer.parseInt(csony);
        String clg = request.getParameter("clg");
        if (clg != null) cam+= Integer.parseInt(clg);
        String cnokia = request.getParameter("cnokia");
        if (cnokia != null) mob += Integer.parseInt(cnokia);
        String cerricson = request.getAttribute("cerricson");
        if (cerricson != null) mob += Integer.parseInt(cerricson);
        total = cam + mob;
        session.setAttribute("cambill",new Integer(cam));
        session.setAttribute("mobbill",new Integer(mob));
        session.setAttribute("billamnt",new Integer(total));
        PrintWriter pw=response.getWriter();
        pw.println("<html><body><a href="+"mobs"+">Mobile</a><br><a href="+"cams"+">Camera</a><form method = "+"post "+"action ="+"bill"+"><br><input type= "+"submit"+"></form></body></html>");
        pw.close();
    }Message was edited by:
    stevejluke

Maybe you are looking for

  • How to delete a user in SAP-CPS Version 7.0

    Hello, I created my users via UME ( User Management Engine of Java Application server). Unfortunately I used the wrong name convention, so I had to recreate all the users in UME. Afterwards I delete all wrong users in UME. Than I tried to login with

  • Collecting Log Files

    When providing feedback around reported issues we may request you access and share certain log files from your computer in order to better understand the operation of the Creative Cloud app on your system. Below is information about various log files

  • AirPort Extreme vs 2WIRE

    I just got my new MacBook 2 days ago, I have a 2WIRE router and haven't been able to connect wirelessly. I have tried absolutely everything (putting $ before te password, making it a public net, installing the AirPort updates...) Nothing seems to wor

  • Any alternate function for FLD in NW7.5

    Hi All Is there any alternate function for FLD in NW7.5. I can't use FLD in NW. In one my script logic i need to get value from property and multiply with an account. Edited by: satish193 on Mar 29, 2011 2:15 PM

  • Date Control issue in 64 bit Windows

    Hi,           The problem I am facing is "ActiveX control of mscal.ocx" is not working in 64 bit system [both server and client machine]. But, it is working in 32 bit machine. I tried registering mscal.ocx from "syswow64" folder and tested it. But it