This term can mean different things, depending on who is talking and the context. In one sense, a widget is any sort of small, as-yet unnamed mechanical item, and the term is often used interchangeably with “gadget.” Within the web development community, it is a piece of self-enclosed code that can be embedded into a website or program to perform a specific function. Many websites take advantage of this type of code to increase their functionality and customizability.
The word appears to be American in origin, and it first appeared in print in 1924, as a generic placeholder name in a play. It was used to describe the products of a factory; the end product was not as important as the process of working in the factory, creating small, seemingly meaningless items in a repetitive way which ate away at the soul of the hero. Over time, the word came to be adopted into common English.
There are two ways in which a “widget” can be used in this sense. In the first case, the word is a placeholder, referring to any sort of mechanical artifact. The term is often used this way in the arts, where a character in a movie might work at the Acme Widget Company, or someone in a book might be famous for inventing one. In this case, the precise identity of the item is not important, and a placeholder is used so that people do not become distracted.
The term is also used to describe hypothetical products that may someday be invented, or products that are in the development stages. A developer for a car company might say, for example, that it would be nice to have one that stored data about gasoline efficiency for the use of the driver, or someone might say that he or she is “working on a widget” for a company. Since product naming is an extremely important step in the development of a product, the use of a generic term allows people to discuss the project without forcing a name on it, and it has the advantage of also protecting product secrecy.
In the computing world, widgets appear in a wide range of places. Many bloggers and users of social networking sites take advantage of them to make their sites more interesting and fun for their users. One may do any number of things, from organizing a blogger's posts by topic to allowing people to play interactive games with other users of a website. These pieces of code are typically developed by third parties, and users should take care when using and installing them, as they may contain malicious code. As a general rule, it is a good idea to get ones that have been officially approved for a website or platform.