For Canada, you can apply either from your country of residence or from your country of nationality. From the Canadian Government website:
Select the country/territory you will be applying from to find out where to submit your application. You can choose your country of nationality or the country/territory where you have been legally admitted.
Note also that the Government of Canada has contracted with a private company (VFS Global) to establish a set of visa application centers (VACs) in various locations around the world, including many countries in which Canada does not have a diplomatic station. These centers:
- answer questions in local languages and make sure that applications are complete
- transmit application documents and passports to the visa office securely
- return passport and decision documents securely
- offer a tracking service
- schedule interviews and provide application photographs and photocopies for a fee
- provide access to a computer to apply online
- collect biometrics (fingerprints and photograph)
In particular, there is a VAC in Priština if you wish to apply from within Kosovo. This VAC would forward your application to the visa office in Vienna, where the visa determination would be made. (Note that if you applied from within Germany, your application would also be evaluated in the Vienna office.)
You apply from your country of residence mostly. If you are residing in Germany with a work visa you apply from there, you don’t have to go back to your home to apply for a visa for any 3rd country.
This does not usually apply to people who are on a visit visa in the country they wish to apply from.
Every country has different residency requirements for visitors hence unless you specify some countries its hard to list all in an answer.
For example, US does not put any conditions on the applicant to apply only from the country of citizenship but then the onus is on the applicant to prove significant ties to the country of residence. So even in cases where its perfectly fine to apply like that its not going to be a piece of cake.
For another example, UK has this to say
1. Applications for short-term visas and EEA family permits
You can make applications for a visit visa, a short-term study visa or EEA family permit in any visa application centre, British diplomatic mission or consular post overseas where entry clearance applications are accepted.
You should be present legally in the country or territory you’re applying from.
2. Applications for other entry clearance
Applications for other types of entry clearance (except for Tier 5) should be made in your country of residence. ‘Country of residence’ might not be your country of origin and refers to wherever you have permission to live, for example for work or study purposes. Many countries issue overseas nationals with residency cards in these circumstances. If you have permission to stay in a country as a visitor for 6 months, for example, you are not a resident.
Where there is no post in the country where you live, you should make the application to the appropriate application post.
Credit:stackoverflow.com‘