In 2009, Obama attended a "dignified transfer" at Dover Air Force Base and held a salute for 45 minutes. He did not wear a baseball cap like he was attending a ballgame.
@mariejulien Looks like it started with Reagan.
"The U.S. military salutes the President as a sign of respect to the Commander-in-Chief, who represents the highest civilian authority over the armed forces. While military regulations require personnel to salute the President, the tradition of the President returning the salute only became standard under President Reagan in 1981."