GeoLeaf Core API - v3.0.0
    Preparing search index...

    Function validateUrl

    • Validate a URL strictly against a protocol whitelist (http, https, data:image).

      Parameters

      • url: string

        The URL string to validate.

      • OptionalbaseUrl: string

        Optional base URL for relative URL resolution. Defaults to location.origin.

      • Optionaloptions: ValidateUrlOptions

        Optional: set httpsOnly: true to reject http: (production hardening).

      Returns string

      The normalized absolute URL string.

      Rejects javascript:, vbscript:, data:text/html and other dangerous protocols.

      If the URL is invalid or the protocol is not allowed.