Funerary Prayer in Absentia

Question Following the death of the former deposed Egyptian President, many Muslims around the world performed Ṣalāt-ul-Janazah (funerary prayer) for him.  Is this something that has precedent in Islam?  Why are others seemingly opposed...