title: How to check url exist or not in angular 6?
body: <p>I want to check if a url exist or not. I'm trying using this code:</p>
  
  <pre><code>let request;
  if ((&lt;any&gt;window).XMLHttpRequest) {
      request = new XMLHttpRequest;
      request.open('GET', 'http://www.mozilla.org', true);
  } else if ((&lt;any&gt;window).ActiveXObject) {
      request = new ActiveXObject('Microsoft.XMLHttp');
  }
  
  if (request) {
      console.log('rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr', request);
  
      request.open('GET', 'https://www.google.com');
      if (request.status === 200) {
          console.log('Valid Url');
      } else {
          console.log('Invalid Url');
      }
  }
  </code></pre>
  
  <p>But it doesn't work. It always return Invalid url. How can I check if the url exist or not.</p>