def validate_url_domain(u)
      # Enforce a few bare standards before proceeding
      u = "#{u}"
      u = "/" if u.empty?

      begin
        # Look for evidence of a host. If this is a relative link
        # like '/contact', add the page host.
        domained_url = @host + u unless (u.split("/").first || "").match(/(\:|\.)/)
        domained_url ||= u

        # http the URL if it is missing
        httpped_url = "http://" + domained_url unless domained_url[0..3] == 'http'
        httpped_url ||= domained_url

        # Make sure the URL parses
        uri = URI.parse(httpped_url)

        # Make sure the URL passes ICANN rules.
        # The PublicSuffix object splits the domain and subdomain
        # (unlike URI), which allows more liberal URL matching.
        return PublicSuffix.parse(uri.host)
      rescue URI::InvalidURIError, PublicSuffix::DomainInvalid
        return false
      end
    end
def validate_url_domain(u)
      # Enforce a few bare standards before proceeding
      u = "#{u}"
      u = "/" if u.empty?

      begin
        # Look for evidence of a host. If this is a relative link
        # like '/contact', add the page host.
        domained_url = @host + u unless (u.split("/").first || "").match(/(\:|\.)/)
        domained_url ||= u

        # http the URL if it is missing
        httpped_url = "http://" + domained_url unless domained_url[0..3] == 'http'
        httpped_url ||= domained_url

        # Make sure the URL parses
        uri = URI.parse(httpped_url)

        # Make sure the URL passes ICANN rules.
        # The PublicSuffix object splits the domain and subdomain
        # (unlike URI), which allows more liberal URL matching.
        return PublicSuffix.parse(uri.host)
      rescue URI::InvalidURIError, PublicSuffix::DomainInvalid
        return false
      end
    end
Normalize and validate the URLs on the page for comparison