Javascript: Check link does not exist or expired

 

    async function fetchLinks(content) {

      // create blog content obj

      var contentObj = document.createElement('div');

      contentObj.innerHTML = content;

      var links = contentObj.getElementsByTagName('a');

      for(var i = 0; i < links.length; i++){

        // nodes[i].parentNode.removeChild(nodes[i]);

        try {

          const href = links[i].getAttribute('href');

          const request = new Request(href, {

            method: "HEAD",

          });

          const response = await fetch(request);

          // waits until the request completes...

          if (response.status == '410' || response.status=='400') {

            console.log(href);

          }

        } catch (error) {

          // console.log(error);

        }


      }


    }


Không có nhận xét nào:

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...