5 Replies Latest reply: May 11, 2011 10:55 AM by Milo Velazquez-Oracle RSS

    Navigate to external URL from secured APEX server

    Milo Velazquez-Oracle
      NOTE I am using the internal Oracle APEX server to host my application, so it may be possible that you will have to be an Oracle employee with the same access, or using a similar setup, in order to respond. Even if you are not, if you feel inclined to "take a swing" at it, keep this in mind.

      Hi all,

      I am using the internal APEX server at oracle to host an application (Application Express 4.0.2.00.07). I have other, NON-APEX applications hosted on other servers within the Oracle firewall.

      On page 0 of the APEX application (which, as you may know, usually displays as the "header" section of every other page in the application) I have created a select list of the other projects and their associated URLs as well as a "Go" button, so users that want to navigate to the other applications can do so from this application. Since page 0 does not seem to allow the creation of standard branch items (please correct me otherwise), I have created a process on that page triggered by the "Go" button. The process currently contains the following code:

      begin
      apex_application.g_unrecoverable_error := true;
      htp.p('<script language="JavaScript">
      window.open (:P0_PRODUCT_PAGES); <!-- :P0_PRODUCT_PAGES being the URL of the selected non-APEX application -->
      </script>');
      end;

      That code currently replaces the existing page with a blank page and the associated URL is "https://apex.oraclecorp.com/pls/apex/wwv_flow.accept". I am assuming this means that APEX was looking for an application ID and/or page and did not get it so it "stopped" at this page.

      I am unaware if there are any settings on the APEX server, DB,or associated web server preventing me from navigating outside of APEX once I am running the hosted application.

      I would like to launch another properly-sized (default) browser window rather than replace the existing window pointing to the URL for the selected application.

      I have also tried using the owa.util code to try to generate the proper URL but was likewise unsuccessful.

      NOTE: I am not looking for different ways to do this by changing server parameters, settings, etc. since I do not have server rights to do this. Additionally, due to time constraints, I would prefer not to be drawn in to a discussion of the comparisons and/or benefits of owa.util or javascript over the other for navigating to an external URL from within APEX, etc. (I'm not trying to be a "punk", but I AM under the gun to resolve this with very limited time). In light of this, please indicate if you have a working option to do this under similar conditions that I can implement quickly. I have done much research within the forums and Googled extensively for information from outside sources but have not yet found something that will provide the proper results.

      If you are an oracle employee and wish to contact me directly, please email me at milo.velazquez@oracle.com

      Crossing my fingers and hoping someone has done this before.

      Many thanks in advance; your useful contribution will actually contribute to lessening the world's INSOMINA factor considerably (mostly mine). ;)
        • 1. Re: Navigate to external URL from secured APEX server
          438381
          Why not create a 'list' region in page 0 ? The elements of the list can them have their targets set to the external URLs that you want to allow navigation to..

          varad
          • 2. Re: Navigate to external URL from secured APEX server
            Milo Velazquez-Oracle
            Hi Varad,

            Thanks for your reply.

            If you are asking why I am using a select list rather than a bullet list of links, I am constricted by the browser look and feel (BLAF) of the other applications which I need to match.

            More importantly, and I think I should have emphasized this, the issue is not whether I use a link or set a value for the link and execute the value, but rather the fact that I cannot seem to navigate to a URL ouside of APEX. If the link is to another application or application page, the URL works correctly, but not if it goes to an "external" URL like "www.google.com" or a registered URL inside Oracle (servername.oracledomain.com).

            Hope that clarifies the issue.
            • 3. Re: Navigate to external URL from secured APEX server
              Jeff E
              Does it work if you add the following code to the button attributes?
              onclick="window.open ($v(P0_PRODUCT_PAGES)); "
              • 4. Re: Navigate to external URL from secured APEX server
                fac586
                >
                I would like to launch another properly-sized (default) browser window rather than replace the existing window pointing to the URL for the selected application.

                I have also tried using the owa.util code to try to generate the proper URL but was likewise unsuccessful.
                >

                Opening a URL in a new tab or window has to happen in the browser, without submitting the page. The server doesn't know about browser windows. Use:
                onchange="window.open(this.value);" 
                in the HTML Form Element Attributes property of <tt>P0_PRODUCT_PAGES</tt> (making the "Go" button unnecessary), or, if the "Go" button is required to match the LAF:
                onclick="window.open($v('P0_PRODUCT_PAGES'));"
                in the button Attributes property, ensuring the button is a template button including the <tt>#BUTTON_ATTRIBUTES#</tt> substitution string, e.g.
                <input type="button" value="#LABEL#" #BUTTON_ATTRIBUTES# />
                Ensure that absolute URLs are used in the <tt>P0_PRODUCT_PAGES</tt> where necessary, specifying the correct scheme for the site, so that you are not trying to go to <tt>{noformat}https://apex.oraclecorp.com/pls/apex/www.google.com{noformat}</tt> for example:
                f?FOO:BAR:&APP_SESSION.    // other APEX app hosted on apex.oraclecorp.com sharing the same authentication scheme
                
                https://foo.oraclecorp.com // other secured internal site
                
                http://www.google.com      // unsecured external site
                • 5. Re: Navigate to external URL from secured APEX server
                  Milo Velazquez-Oracle
                  Jeff E, fac586

                  EXCELLENT!!!!

                  I can't begin to tell you how long this little annoyance on the application has been hounding me and I NEVER thought to bypass APEX altogether, even though I have done this on numerous occasions in reports. So simple and so obvious; you were both very insightful.

                  I, on the other hand, must be getting old. ;)

                  THANK YOU!!

                  Edited by: Milo Velazquez on May 11, 2011 8:53 AM