Skip to content

isUrl JavaScriptDart

Returns true if the given data is in the correct URL format. If withProtocol is true, it is automatically appended to the URL when the protocol does not exist. If strict is true, URLs without commas (.) return false.

Parameters

  • url::string
  • withProtocol::boolean || false Dart:Named
  • strict::boolean || false Dart:Named

Returns

boolean

Examples

javascript
isUrl('google.com'); // Returns false
isUrl('google.com', true); // Returns true
isUrl('https://google.com'); // Returns true

Released under the MIT License