Frontend Modules / js/utils/url / addMissingUrlScheme
Function: addMissingUrlScheme()
addMissingUrlScheme(
value):string
Defined in: js/utils/url.ts:32
Prepend a scheme to a URL if it does not contain one yet. The scheme is chosen based on the value:
email addresses get “mailto:”, e.g. “info@example.com” becomes “mailto:info@example.com”
phone numbers get “tel:”, e.g. “+49 821 123456” becomes “tel:+49821123456”
everything else gets “https://”, e.g. “www.example.com” becomes “https://www.example.com”
Parameters
value
string
The URL entered by the user
Returns
string
The URL including a scheme