"Hej Slaveni" was composed in the mid nineteenth century by a Slovak in response to the loss of cultural identity in his homeland. Taking inspiration from the Polish anthem (which the melody is almost identical to), he composed an anthem that soon became popular with the whole Slavic community, in fact becoming the anthem of Slovakia during World War II (with Slovak words). Being a confederation of mainly Slavonic states, the song seemed to be a natural fit for post-royalist Yugoslavia. It was sung at the first meetings of the resistance movement (later, the government), and became the temporary national anthem upon the re-establishment of Yugoslavia after the Axis defeat. A search was undertaken for a permanent anthem, but "Hej Slaveni" remained the most popular choice with the citizens; it was declared the temporary anthem in 1977, and was finally made official in 1988.
After most of the members of the Yugoslav federation had declared independence in the 1990s, the nations that were left in the federation changed the name of the country to Serbia and Montenegro, and retained the old Yugoslav anthem.Since that time, there were proposals to change the national anthem, one of which by Slobodan Markovic recieved government attention, which consists of all but the last line of the Serbian "Bože pravde" followed by one verse of the Montenegrin "Oj svijetla majska Zoro", and was being considered to replace "Hej, Sloveni" in time for the 2004 Olympic Games. "Hej Slaveni" remained the anthem during this time, despite the local anthems of the two republics in the federation being more popular. With the independence of Montenegro, and then Serbia in 2006, the union was dissolved and the anthem had no more legal standing. The words and music were written by Samuel Tomášik (based on a traditional song) and was in use from 1945 to 2006.
The postcard above shows the lyrics of the former Yugoslavian anthem.