htmlsessionhyperlinkoracle-apeximagemap

Oracle APEX - HTML Links Breaks Session and Requires New Login


Ok so here is what is happening:

I have a client that I am building an application for. My client has a flowchart that they would like posted on the front page of their application. Check. My client then wants this flowchart to be set up as an image map so that a user could click one of the boxes in this flowchart and be taken to a report in another part of the application. Check.

All of that is elementary and, in a technical sense, works. The issue is, and it is an issue I have encountered before with APEX, is that every time a user clicks one of these links it takes them to the login screen. It seems that linking directly to a page's URL breaks the session and requires you to login again, even if you are linking from one page in the application to another in the same application.

I have played with all of the authentication settings in a hopes of fixing this and tried to determine what is breaking the session exactly but with no luck.

Has anyone else had this problem and could share their method for fixing it? I really cant have users logging in every time they click a link and I also cannot simply remove the authentication on the pages. Thanks in advance.


Solution

  • You should pass on the session id in your links. If you don't, then apex will see this as a new session. You can tell from the url: take note of the session id in your url when you are on your image map. When you select an application, take another look at the session id part in the url. If they are different, then you are starting a new session each time.

    /apex/f?p=190:90:1674713700462259:::::
    

    To pass on the session, it depends where you construct your links. In PLSQL, you can find it through :SESSION or :APP_SESSION

    For example, in a plsql dynamic region: htp.p('the session id is '||:SESSION);

    In javascript code you can use $v("pInstance") to retrieve the value dynamically, or use &APP_SESSION. which will have the value substituted at runtime. Small example:

    function printsome(){
    var d = $("<div></div>");
    d.text('&APP_SESSION. = ' + $v("pInstance"));
    $("body").append(d);
    };
    

    So you probably just need to alter the construction of your link somewhat to include the session!