HARMs work by homing in on radar emissions of SAM site radars.
The advantage of the HARM over the shrike, is its higher speed
(around Mach 5), allowing it to outrace most SAMs, so if a fighter
is fired on by a SAM, it can destroy the radar of the SAM site with
the HARM before the SAM actually hits the aircraft. Other
advantages are that the HARM has a smokeless motor, coupled with
its higher speed, would cause SAM operators not to notice the
incoming missile before its too late, preventing them from
switching off their radars in time. The HARM also has an inertial
guidance system, allowing the missile to home onto the last known
position of the SAM radar if the SAM operator manages to switch off
its radar before the missile hits.
If you look at our surrounding SAM threats, most of them are low
altitude optically or infrared guided SAMs, which ARMs(anti
radiation missiles) are useless against. Indonesia expressed an
interest in procuring the russian S-300(SA-10) system some time
ago, and ARMs would have been effective against it. If that deal
had materialized, we would probably have gotten the AGM-88s.
however, it did not, so we were stuck with the AGM-45s carried by
the A-4s.
The rise of Chinese military power might cause us to procure the
AGM-88 in the near future though, as they make use of many long
range SAM systems that the HARM might be useful against.