This article is from the FAQ, by with numerous contributions by others.
You are normally best advised to apply from the country of last residence
or home country. But as a practical matter, a U.S. consulate in a third
country may give you the visa. It depends upon whether or not that
consulate accepts H-1 applications from persons not connected with their
Under the 1996 immigration law, if you have ever been out of status,
you will not be permitted to apply for a visa in a third country,
unless you fall under certain limited exceptions. Some more details