Strikegently
Strikegently

Reputation: 2451

PL\SQL - OWA_UTIL.REDIRECT_URL open in new tab

In PL\SQL, is it possible to open a URL in a new tab/window, instead of the existing one?

I know there is the OWA_UTIL.REDIRECT_URL function, but this makes the current page redirect to the specified URL. I would like to open the URL in a new tab or window.

For example:

OWA_UTIL.REDIRECT_URL('https://google.com')

will redirect the current browser tab to google.com, when I would like to keep the current tab open and open a new tab/window to google.com

Upvotes: 0

Views: 3387

Answers (2)

Ahmed Alwahib
Ahmed Alwahib

Reputation: 131

You can redirect using OWA_UTIL.REDIRECT_URL and assign variable :status to X-ORDS-STATUS-CODE in OUT headers

like this:

redirect with X-ORDS-STATUS-CODE

DECLARE
    l_url varchar2(2000);
BEGIN
    l_url := 'https://google.com/';
    owa_util.redirect_url(
        curl            => l_url,
        bclose_header   => TRUE
     );
    :status := 303;
END;

Upvotes: 0

Wernfried Domscheit
Wernfried Domscheit

Reputation: 59476

I don't think this is possible. OWA_UTIL.REDIRECT_URL is like a redirect in .htaccess file. There you cannot specify "open in new tab" either. You would need to deploy some JavaScript in your page.

A solution similar to this might work:

HTP.PRINT ('<html><head>');
HTP.PRINT ('<script type="text/javascript">');
HTP.PRINT ('window.onload = function () {');
HTP.PRINT ('  var url = "https://google.com";');    
HTP.PRINT ('  var win = window.open(url, '_blank');');
HTP.PRINT ('  win.focus();');
HTP.PRINT ('}');
HTP.PRINT ('</script>');
HTP.PRINT ('</head><body></body></html>');

Upvotes: 2

Related Questions