Home > widget-integration > CountdownTimerController > isSafeUrl

CountdownTimerController.isSafeUrl() method

Validate that a URL is safe for navigation.

Allows http:, https:, and relative paths. Blocks javascript:, data:, vbscript:, protocol-relative URLs, and any other scheme.

Signature:

protected isSafeUrl(url: string): boolean;

Parameters

Parameter

Type

Description

url

string

The URL string to validate

Returns:

boolean

true if the URL is safe for window.location.href assignment

Example

Override to also allow mailto: links:

protected isSafeUrl(url: string): boolean {
  if (url.trim().startsWith('mailto:')) return true;
  return super.isSafeUrl(url);
}