SQL iQuery Script Built-in Function

Index

isBrowser

Is iQuery Running interactively?

The ISBROWSER() built-in functions returns true if the SQL iQuery Script is running from a CGI program evoked from a web browser.

Syntax

The ISBROWSER() built-in function returns true if the iQuery Script was evoked from an application that was subsequently evoked from a web browser.
Users may specify an optional identifier as the first parameter. This identifier is used to search the HTTP_USER_AGENT environment variable. If the identifier is found, it returns true. If the identifier is not found, it returns false even if running from a browser.
For the optional parameter, the available user-agents are documented at mozilla.org.

Parameters

  1. An optional Browser-Identity String or "user agent token" to be searched.

if IsWeb();
if (isBrowser('chrome');
// do Chrome browser specific stuff here.
elseif isBrowser('mobile');
// do mobile device specific stuff here.
elseif isBrowser('Edg/');
// do Microsoft Edge Browser stuff here.
elseif isBrowser('Mozilla');
if isBrowser('Apple');
// Do Apple stuff here
elseif isBrowser('Windows')
// Do Microsoft stuff here
endif;
endif;
endif;
select * from foo;

The above script checks if running as a CGI/Web application, then checks for various browser environments and specific operating system platforms. Note that Microsoft Edge browser uses Edg not "Edge" in the User Agent token, so make sure you review the user agent settings for Microsoft Edge if you plan on doing specific/custom scripts based on Edge.