Many anchor tags on my website have Windows ".exe" file link in its href attribute.
If that anchor tag is clicked on Mobile or Mac OS, I want to popup a message: "Sorry only available on Windows".
Any anchor tag whose href ends with ".exe" matches the condition. How can I select such anchor tags in jQuery?
For example:
<a href="http://www.example.com/downloads/abc.exe"></a>
should be selected by jQuery because it ends with ".exe"
But
<a href="http://www.example.com/downloads/abc.jpg"></a>
should "NOT" be selected by jQuery because it does not end with ".exe" in it.
I have the following code:
if (/Mobi|Android/i.test(navigator.userAgent))
{
jQuery("a[href*='.exe']").attr("href","#popmake-1117");
}
But it detects .exe anywhere in the href, and not in the end. Also, it works only on mobiles and not on Mac.