Some browser addons and web-services for website/dictionary translation sometimes offer a "automatic-language-detection" feature. This works more or less in my experience.
There is probably a variety of different possible algorithms, like indexing some words of a website and compare them with different dictionaries. Is this the way most of those software do language-detection, comparing 5-10 words of the website with many dictionaries or are there smarter and faster algorithms? For example, languages with romanic letters. What would be a very efficient and reliable criterion to derive the language without the need of many big dictionaries, so it might fit into a small app.
The wiki article for language detection mentions functions words as a older method. I would guess, words used after/before punctuation marks might be even more effective for most european languages? Especially on multi-language websites where distinct function words might occur in quoted text/link names?