I wanted to check whether apex is called from a browser session by entering an url or from an internet application.

The command I wanted to use is:

owa_util.get_cgi_env(‘HTTP_REFERER’);

This command returns the (parent) url. However, when the apex application is called by using javascript (window.open) this command wil return null instead of the parent url.

Javascript workaround:

var a = document.createElement(“a”);
if(!a.click) //for IE
{
window.location = ‘<url>’ ;
return;
}
a.setAttribute(“href”, ‘<url>’);
a.setAttribute(“target”, ‘_blank’);
a.style.display = “none”;
document.body.appendChild(a);
a.click();

This code creates dynamically a link on the current page and kick’s of the click-function.