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:


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>’ ;
a.setAttribute(“href”, ‘<url>’);
a.setAttribute(“target”, ‘_blank’);
a.style.display = “none”;

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