LONDON — It’s hard to keep a secret when the internet is watching. Especially if plane spotters are involved.

Reporters accompanying President Trump on his visit to American troops in Iraq on Wednesday, his first to a combat zone, were sworn to silence. Air Force One was given a call sign that identified it as a military cargo flight. Mr. Trump himself later marveled at having traveled on a “darkened plane, with all windows closed, with no lights on whatsoever, anywhere — pitch black.”

But that wasn’t enough to stop a semiretired information technology specialist in Sheffield, England, from spotting and photographing the jet, or to prevent fellow aviation enthusiasts online from deducing what was happening, hours before Mr. Trump arrived at Al Asad Air Base in Iraq.

The information technology specialist, Alan Meloy, who describes himself on the photo-sharing website Flickr as “a lifelong aviation nut,” looked out from his kitchen window in Chapeltown, a suburban district of Sheffield, on Wednesday morning and saw an unusual plane flying above. He quickly took a long-lens photograph and posted it online.