Using hooks to detect a Web session

When writing hooks, you can use the HCL Compass API to detect whether a user is using a Web client.

This information 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 Web session in a function that creates a message box or a new window, you can call code modified for the Web environment or exit the function. The following code examples can be used to detect a Web session.

VBScript

dim currDBSession ' Current Db session
set currDBSession = GetSession

' Test for existence of the web session variable.
if currDBSession.HasValue ("_CQ_WEB_SESSION") then
' Either exit or do something else
end if

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
}