Check broken link?

Check broken link?

Hi all,

I have a site that uses a CMS and it automatically generates a link to a PDF file depending on a Product name.

Is it possible to use some JS that will check if a particular link is valid or not? i.e. if the PDF file doesn't exist, then apply some kind of formatting to the link.

Is this possible?