Skip to main content
Version: Next

WA SET EXTERNAL LINKS FILTERS

WA SET EXTERNAL LINKS FILTERS ( {* ;} object ; filtersArr ; allowDenyArr )

ParameterTypeDescription
*OperatorIf specified, object is an object name (string) If omitted, object is a variable
objectanyObject name (if * is specified) or Variable (if * is omitted)
filtersArrText arrayFilters array
allowDenyArrBoolean arrayAllow-deny array

Description

The WA SET EXTERNAL LINKS FILTERS command sets up one or more external link filters for the Web area designated by the * and object parameters. External link filters determine whether a URL associated with the current page via a link must be opened in the Web area or in the default Web browser of the machine.

When the user clicks on a link in the current page, 4D consults the list of external link filters in order to check whether the URL requested must be opened in the browser of the machine. If so, the page corresponding to the URL is displayed in the Web browser and the On Open External Link form event is generated. Otherwise (default operation), the page corresponding to the URL is displayed in the Web area. The evaluation of the URL is based on the contents of the filtersArr and allowDenyArr arrays.

The filtersArr and allowDenyArr arrays must be synchronized.

  • Each element of the filtersArr array must contain a URL to be filtered. You can use the * as a wildcard to replace one or more characters.
  • Each corresponding element in the allowDenyArr array must contain a Boolean indicating whether the URL must be opened in the Web area (True) or in the Web browser (False).

If there is a contradiction at the configuration level (the same URL is both allowed and denied), the last setting is the one taken into account.

To disable URL filtering, call the command and pass empty arrays or pass, respectively, the values "*" and True in the last elements of the filtersArr and allowDenyArr arrays.

Important: The filtering established by the WA SET URL FILTERS command is taken into account before that of the WA SET EXTERNAL LINKS FILTERS command. This means that if a URL is denied because of a WA SET URL FILTERS command filter, it cannot be opened in the browser even if it is explicitly specified by the WA SET EXTERNAL LINKS FILTERS command (see example 2).

Example 1

This example causes sites to be opened in external browsers:

 ARRAY STRING(0;$filters;0)
 ARRAY BOOLEAN($AllowDeny;0)
 
 APPEND TO ARRAY($filters;"*www.google.*") //Select "google"
 APPEND TO ARRAY($AllowDeny;False)
  //False: this link will be opened in an external browser
 APPEND TO ARRAY($filters;"*www.apple.*")
 APPEND TO ARRAY($AllowDeny;False)
  //False: this link will be opened in an external browser
 WA SET EXTERNAL LINKS FILTERS(MyWArea;$filters;$AllowDeny)

Example 2

This example combines the filtering of both sites and external links:

 ARRAY STRING(0;$filters;0)
 ARRAY BOOLEAN($AllowDeny;0)
 APPEND TO ARRAY($filters;"*www.google.*") //Select "google"
 APPEND TO ARRAY($AllowDeny;False) //Deny this link
 WA SET URL FILTERS(MyWArea;$filters;$AllowDeny)
 
 ARRAY STRING(0;$filters;0)
 ARRAY BOOLEAN($AllowDeny;0)
 APPEND TO ARRAY($filters;"*www.google.*") //Select "google"
 APPEND TO ARRAY($AllowDeny;False)
  //False: this link should be opened in an external browser but this setting
  //has no effect because the link will be blocked by the URL filtering.
 WA SET EXTERNAL LINKS FILTERS(MyWArea;$filters;$AllowDeny)

See also

WA GET EXTERNAL LINKS FILTERS
WA SET URL FILTERS

Properties

Command number1032
Thread safe