What if a source is online?

The intellectual content of a piece, not the physical format, determines whether it's primary or secondary.

The text of a diary is a primary source whether you read the original, 100-year-old volume, or a digital reproduction on the web. Either way, you're getting firsthand evidence.

A historian's article about the causes of World War II is a secondary source, whether you read the published version or her handwritten first draft. Either way, you're getting an interpretation of the events.