Button on page 0 -- Close current window

I have been asked if its possible to close the current window when a user clicks on a button.
(I suspect this will involve some javascript)
any example would be appreciated

Keith,
Add this to the HTML Header of the page:
<script type="text/javascript">
//<![CDATA[
   function closeWindow() {
      window.opener = self;
      window.opener.close();
//]]>
</script>Then call the function from a button by setting the button's optional URL redirect to:
javascript:closeWindow();Regards,
Dan
http://danielmcghan.us
http://sourceforge.net/projects/tapigen
http://sourceforge.net/projects/plrecur
You can reward this reply by marking it as either Helpful or Correct ;-)

Similar Messages

  • How can I close current window.

    I have a submitButton.
    When I click it, using a method of javascript to close current window.
    the coding like below:
    pageContext.putJavaScriptFunction(
    "closeCurrentWindow",
    "javascript:window.opener=null;window.close()");
    pageContext.getJavaScriptFunction("closeCurrentWindow");
    But I think it's not a idea.
    Do you have another recommendations about the solution of this problem?
    thx.

    Hi,
    I don't understand. Would you like to have a button to close the current window?
    Or should it do also something else?
    If you want only to close the window you can use a "button" (not item_style = "button", not "submitButton").
    Then you must set its Destination URI property to javascript:self.close();
    This will close the current window.
    However note that using javascript is not right, according to OAF standards.
    Bye
    Raffy

  • HTML-DB OAE Javascript to close current window and open a new window

    Hi everybody,
    We work with 1.6.
    What we want is to close the current window and open a new window with the URL mentionned in the window.open('http://www.cf.qc/pls/portal/PORTAL.....,'newwindow').
    The new window opening fires only once although we call it many times.
    Our javascript is:
    function closeTest()
    { alert('closeTest');
    if('&REQUEST.'=='QUITTER2'){     
    w = window.self;
    w.opener = w;
    w.close();
    window.open('http://www.cf.qc/pls/portal/PORTAL.home','newwindow','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
    We call it on our application attributes :
    OnLoad="closeTest()"
    Thanks. Bye.

    Try this on for size:
    I have included two functions.
    windowRebuild() - opens a new window, maximizes it based on the screen size, removes all toolbars, and then closes the old window.
    myLocation(appName, pageName) - builds a url referencing an HTMLDB application, specfic to what server you are currently on. Very useful when you have an application on 3 different servers(dev, test, prod servers), you wouldn't want the server name hardcoded if you plan to export the app to another server.
    Also, you need to be careful when using &APP_ID. I am not completely certain how that is resolved at runtime, but I've found it only works when the javascript is in the HTML Header of a page and not stored in the template of the page.
    <script language="JavaScript1.1" type="text/javascript">
      This functions is for internal application use.
      Examples of myLocation:
      url = myLocation('&APP_ID.', 'APP_PUBLIC_PAGE');
      url = myLocation('MY_APP_ALIAS', 'MY_PAGE_ALIAS');
      url = myLocation('184', '10');
    function myLocation(myApp, myPage){
      var myHost = location.host;
      var newURL;
      newURL = 'http://'+myHost+'/pls/htmldb/f?p='+myApp.toString()+':'+myPage.toString();
      return newURL;
    /*  Function windowRebuild()
    *   This function will open a new window and close the old window.
    *   This function will also maximize the new window and remove all toolbars.
    function windowRebuild(){
       if(window.name != 'myAppWin'){
        var url = myLocation('&APP_ID.', 'PAGE_ALIAS');
        var myWin = window.open(url,'myAppWin','toolbar=0,scrollbars=1,menubar=0,status=1,resizable=1,location=0');
        window.opener = 'x';
        window.close();
       if(window.name == 'myAppWin'){
        window.moveTo(0,0);
        window.resizeTo(screen.availWidth,screen.availHeight);
    </script>Let me know if that works or you need some more explanation.
    Chris

  • How to close current window in firefox

    hi friends ,
    i  am doing a web application in flex4 .now i am running in that firefox.i  want to close the current window while i am clicking close button.but i  couldnt make that please help me
    Thanks,
    B.venkatesan.

    To close Browser try JS  top.window.close();

  • Programatically close current window and open new window

    hi,
    I am in a click event of a button and want to close the current window and open a new window if a condition is met.
    else if(MyText.Content=="OpenNew")
    newwindow sw = new newwindow();
    sw.Dispatcher.Invoke(new Action(() => sw.Show()));
    this.Dispatcher.Invoke(new Action(() => this.Close()));
    But I always get the System.InvalidOperationException.
    Pls help me with this.
    Thanks,
    Shaleen
    TheHexLord

    If you are trying to create the window on a new thread, you must set the  ApartmentState of the window to STA as described here:
    http://reedcopsey.com/2011/11/28/launching-a-wpf-window-in-a-separate-thread-part-1/
    But you should probably just move the creation of the thread and the call to its Show() method on to the UI thread:
    else if(MyText.Content=="OpenNew")
    this.Dispatcher.Invoke(new Action(() =>
    InfoPanel sw = new InfoPanel();
    sw.Show();
    this.Close();
    Please remember to mark helpful posts as answer.

  • How to close current window  of webdynpro application using webdynpro java

    Hi All,
    u201CTo close the current  window  of webdynpro application"
    if i using exit plug its giving the following error in portal runtime.
    u201Ccom.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Exit-Plug must no be triggered with an URL when running in portal. Use portal navigation instead to navigate to another application! u201C .
    could you send me the  process how to use  portal navigation for the above scenariou2026u2026instead of exitplug.
    Thanks& Regards,
    Srinivas.

    Hi,
    Follow the steps below:
    1. Create a new Window and embed a View which needs to be opened from the main view.
    2. Create a context attribute of type IWDWindow (Java Native Type Option)
    3. Write the following code in the controller for opening the new window:
    IWDWindowInfo windowInfo = (IWDWindowInfo)  
                                                     wdComponentAPI.getComponentInfo().findInWindows("<windowname>");
    IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
    wdContext.currentContextElement().set<contextattributename>(window);
    window.show();
    4. In the new window, create a contextattribute and bind it to the attribute created in controller and on action of the close button write the following code:
    IWDWindow window = wdContext.currentContextElement().get<attributename>();
    window.destroyInstance();
    Hope this helps you.
    Regards,
    Poojith MV

  • How can I close 'current' window and not all windows?

    How can I close the current window (only) and not all or none?
    This function works well with MS Explorer.
    Not a problem, just a desired function.

    Hi JLCluster,
    If you just click the small x in the tab you are currently viewing, it will close only that tab. I think you are clicking the x in upper right hand corner of the screen which closes all open tabs as you described.
    Hopefully this helps!

  • How can I access the Tabs page in the current window, without opening a new tab?

    I like the new Tabs page. I'd like to open it in the current window, without the need of opening a new tab or window.
    Is this possible?

    You can make a bookmark and set the location to about:newtab to open that page in the current tab.

  • Each time I click on a link, firefox opens up the page in a new window, how do I prevent this from happening, ie. view the page in the current window?

    Until I installed an Adobe update, my firefox worked fine, I have had to restore my computer and restart firefox due to advertising which was installed along with the update. Now each time I click on a webpage, a new tab opens and I can no longer view the webpage in the current tab. As you can tell, I am not that computer savy, but I have tried to change all the settings in the options and nothing has worked. I hope this makes sense, please help as it's driving me mad having all of these tabs.

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • MDI is not working, new window close current window

    MDI in a browser was working until we copy the application to a new directory from where the forms is started. We created a new environment file, a copy of the default.env with a changed path for the new directory. We use that new environment file with the parameter envFile when starting the application.

    Complete story :
    We are on application server 10.1.2.0.2
    We had a complete working application. MDI was working. This means we could open multiple windows without any problem.
    On request we need to change application but keep the old version. We use a new database schema and copy the directory with the forms of our application to new directory.
    On the application server we create a new entry for the new application in the ..\\forms\server\formsweb.cfg file. The the old application was using the default.env file where we had added the directory with forms of the old application in the FORMS_PATH in the past. Now with the new application we created new environment file which is a copy of the default.env file. In the new environment file we change the FORMS_PATH, we remove the old application directory and add the new application directory.
    In the new section for the new application in formsweb.cfg, we added the parameter envFile=newenvironmentfile.env
    The application is using the new forms in the new directory but has a problem. when opening a second window the first window is automatic closed. We could not have more than 1 window open.

  • How to open a new window from submit button &dialog page in current window?

    We have a requirement, wherein we have a OAF search page for PO lines with search criteria, Go button to search ,result region (table layout) and a submit button(Create new expedite).
    1. Now user can select some lines from result region and click on Submit button.
    2. On click of submit button we need to pop up a window or may be a dialog page asking that " Do you want open supplier web link portal or not?".
    3. If user clicks yes(in Dialog page) then first fetch the URL from a look up maintained in Oracle EBS on the basis of supplier of the lines selected and then open that URL in a new window and side by side we need to open a dialog page in search page asking "whether user has updated the expedite info in supplier portal or not?". On basis of this we need to updated some count in custom tables.
    So in step 3 i am facing problem, that how to open an URL in a new window through a submit button and side by side want to open a dialog page in the current window also.
    Hope a quick response from you all.
    Note:- To open a custom page we can have a link or button(button of type button and not submit button) on base page with destination url property as following javascript:
    javascript:var a = window.open('OA.jsp?page=/XXX/oracle/apps/xxx/......&retainAM=Y', 'a','height=500,width=900,status=yes,toolbar=no,menubar=no,location=no'); a.focus();
    So the question is how to do the same for submit button on OAF page???

    Antriksh,
    You just need to attach a submit action in button bean and not submit button bean, based on the output of confirm type of alert in javascript.
    Here is code u need to put in destination url of the button:
    //replace <confirm message> by message you want to show.
    javascript:input=confirm('<confirm message>');if(input==true){submitForm('DefaultFormName',0,{XXX:' abc'});}" Now in the process request of the base page CO, u can get parametre 'XXX' from the pagecontext....so
    if((("abc").equals(pageContext.getParameter("XXX"))))
    {/// custom LOGIC }
    The same i have replied in your mail. I hope this resolves the issue.
    --Mukul

  • Still no solution to adding a 'close this window' button to a page

    Hi can anyone help please with this problem? I have used the following html in snippets
    <form>
    <input type=button value="Close Window" onClick="javascript:window.close();">
    </form>
    which shows a button but it does not close the window in all browsers e.g. not in Safari beta or firefox.
    Thanks in anticipation
    Jimbob

    Where do you see the target='_top"? I went looking for the original button from my original post which was in the http://web.me.com/toad.hall/HelperSite//Page1_files/widget3markup.html page via the Activity window and view source and this is what the code of that widget page is:
    <xmp>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title></head><body><form>
    <input type=button value="Close Window" onClick="javascript:window.close();">
    </form> </body></html>
    </xmp> (Ignore the <xmp></xmp> tags when using)
    I don't see the target='_top" in there. What am I missing? This was my first post: http://discussions.apple.com/message.jspa?messageID=9134142#9134142.
    Thanks for the help.

  • In FF 3, Intellimouse ("5" buttons) back button closes only the current tab. In FF4 it closes the window. I prefer the former. How can I get FF4 to do that?

    MS's Intellimouse has five "buttons" including the scroll wheel. I set left and right buttons to L-click & R-click (seems normal). I set left side button to Back and right side button to Close.
    In FF3, Close closes the current tab and Ctrl-W closes the window. In FF4, this is reversed -- Close closes the window and all its tabs and Ctrl-W closes the current tab -- not my preferred behavior.
    The behavior switch in FF4 may or may not have been a function of what somebody had for breakfast. It is was, then I'd like it switched back. If there was an important reason for the switch, I'd like to know.
    Until FF4 reverts to FF3 behavior, I'm probably stuck in FF3.
    In anyhow, thanks -- John Linford, Fort Worth

    Harley, thank you so much. I'll reload FF4 and re-set the settings.
    John

  • How do I add a 'close this window' button to a page please?

    I have tried using the only snippet I can find and it looks good but just does not work. Any ideas would be greatly appreciated. Thanks
    Jim

    A Google search for javascript close window go this response: http://www.google.com/search?client=safari&rls=en-us&q=closewindowjavascript&ie=UTF-8&oe=UTF-8.
    An easy one that I found was:
    <xmp>
    <A href="javascript: self.close ()">Close this Window</A>
    </xmp> *(Ignore the <xmp></xmp> tags when copying)*
    And works fine. When you add the snippet enlarge the results box as it tended to cut off some of the text when published.

  • How to redirect a page to a new window instead of the current one

    Can someone please tell me how to redirect a page to new window.
    I mean I am running a JSP with a button and on clicking it i am opening a new window (thru javascript offcourse),
    Now response.sendirect("New.jsp") should be opened in that new window opened.
    I tried it but the New.jsp page is opened in the current page (Even though new window is opened ! ).
    Please help.

    Hi,
    U can use the following code to Pop up in new window
    Jsp1.jsp
    <%
    if(action != "")
    response .sendRedirect("Jsp2.jsp");
    else
    %>
    <html><head><title>JSP 1</title>
    <script language="JavaScript">
    function View()
    window.open("Jsp1.jsp?action=view","View","");
    </script>
    </head><body>
    <form name="frm" method="post">
    <input type="button" value="View" onclick="View()">
    </form>
    </body>
    </html>
    <%

Maybe you are looking for

  • Smartform loop into internal table problem

    hello experts, i am doing an example given in **************** regarding smartforms. I am getting problem which doing the smartforms . please help me. http://****************/Tutorials/Smartforms/SFMain.htm in that i am doing the program Working with

  • Detecting peaks in blood pressure waveform.

    Hello all. I am studying human pulse waveforms and attempting to detect peaks in real time. I have a continuous stream of data coming in a serial port, this is converted from characters into integer values which are then plotted as a moving waveform.

  • Okay, I just made the switch, and now I am lost...

    i just switched to the iMac...which I adore...but there are a couple of things that are confusing me...I was having an issue with safari freezing, but I read some fixes on here, and I think I fixed it...problem is, the only way I can figure out how t

  • How to copy individual WebDynPro's from ESS Bus Pack for EP 7.0/ ECC 6.0

    Hi, We need to make some small changes to the SAP delivered WebDynPro's. Mostly the changes are related to making some fields as display or change AND some basic edit checks for field values on the screen with messages. Please let me know, if there i

  • Oracle 8i DB Cache

    Hello - I am running Oracle 8i on Sun Solaris. I have determined that my Cache Hit Ratio is very low - 54%. What can I do to increase this to > 95%? Thanks in advance.