Tests if an url is pointing to the same domain as the client or not.

Parameters:
NameTypeDescription
urlstring

The url to test.

Since
  • 1.0.0
Returns:

Whether the passed string is an external url or not.

Type: 
boolean
Example
import { isExternalLink } from "@gravityforms/utils";

function Example() {
  const url = 'https://some-url.com';
  if ( isExternalLink( url ) ) {
      // do something
  }
}