Using hooks to detect a session

You can use the predefined _CQ_WEB_SESSION session variable to detect whether a user is on a Web browser or an installed DevOps Plan application. This allows you to take appropriate action if you have not adjusted your schema to match the functionality available on the Web. For example, when you detect a session in a function that creates a message box or a new window, you can call code modified for the application or exit the function.

  • Session detection in Perl:
    my $currDBSession;   # Current Db session
    $currDBSession = $entity->GetSession();
    # Test for existence of the web session variable
    if ( $currDBSession->HasValue ("_CQ_WEB_SESSION") {
       # Either exit or do something else
       }
    

Functions, such as a message box, that call other Windows applications cause the application to freeze. For example, if a message box function runs on a Web server, the message box pops up on the server's screen. Because the user cannot click OK on the server, the application is left waiting. This requires you to reboot the server. If record scripts return a string value, that string is displayed to the user.