0151 355 4555

IsValid

Description

Checks a website address for validity.

The return value includes the following details:

  • Valid contains a simple boolean value indicating if the web address is valid or not.
  • Host contains the full domain name that responded to the request
  • Tld contains the most significant part of the host name

The service will attempt to validate the supplied web address with and without a leading www.

If the supplied value does not contain a URL scheme (http:// or https://), http will be used.

If any additional part of a URL is supplied it will be ignored. Only the domain is validated.

If the supplied website uses any redirections, the final domain name after following those redirections will be used as the host name in the returned value. Note that if the website uses different redirections for different client languages or IP addresses, the returned host may be different to the one you see if you navigate to the website yourself. For example, if you go to google.com you may be redirected to google.co.uk, google.fr, google.de etc. depending on where you are requesting the page from.

The Tld value in the result will contain the most significant part of the domain name, i.e. without any leading www or other subdomain information.

Because this service is doing a live check on the Internet it can take a few seconds to get a response.

View all Website Validation methods

Code Samples

<!-- Import the Integr8 Ajax API -->
<!-- NOTE: Get your own API key to use in the following script tag from: -->
<!-- http://www.data-8.co.uk/integr8/Admin/Ajax.aspx -->
<script src="https://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">
</script>

<script type="text/javascript">

function loadIntegr8() {
  // Load the WebsiteValidation Integr8 service
  data8.load('WebsiteValidation');
}

function IsValid(domain) {
  /// <param name="domain">string</param>
  var websitevalidation = new data8.websitevalidation();
  
  websitevalidation.isvalid(
    domain,
    null,
    showIsValidResult
  );
}

function showIsValidResult(result) {
  // Check that the call succeeded, and show the error message if there was a problem.
  if (!result.Status.Success) {
    alert('Error: ' + result.Status.ErrorMessage);
  }
  else {
    // TODO: Process method results here.
    // Results can be extracted from the following fields:
    // result.Valid
    //   Indicates if the website is valid
    // result.Host
    //   Contains the full host name of the validated website
    // result.Tld
    //   Contains the top level domain of the validated website
  }
}

loadIntegr8();

</script>