As far as I know, Norway became independent in 1905 via referendum or democratically. I don't understand how a big country like Sweden would let Norway secede without any opposition. My question comes because I'm catalan and in the public TV they talked about how a great example of independence Norway was and how tolerant Sweden was compared to Spain.
There was plenty of opposition from Sweden to the Norwegian secession. The Norwegian parliament had voted for a law enabling Norwegian consulates. The Swedish King, Oscar II, refused to sign the law, and the Norwegian government resigned. As King Oscar II was unable to find willing Norwegians to staff a government, the Norwegian parliament declared the Union dissolved on the 7th of June 1905, citing the inability of the King to appoint a government according to the constitution. Norway held a plebiscite on the 13th of August, where an over-whelming majority of the eligible voters (men over 25) voted for independence. After this negoatiations started in Karlstad on the 30th of August. Negotiations continued, and a military solution of the conflict seemed likely in September.
The international community did not want to see war over the issue. The British, while unwilling to actually commit anything officially, were in favour of Norwegian independence, while the Germans, who had earlier indicated support for Sweden, issued only sympathetic statements for the position of King Oscar II, while Kaiser Wilhelm II in private called the Swedes "Schlappschwänze!" (which translates roughly as cowards) for not having intervened militarily already.
It is important to remember that the Swedo-Norwegian Union was a union between two countries where the foregn and trade policy was controlled by Sweden. Norway had its own army and navy, its own parliament, its own government, its own courts and civil institutions and so on. When it declared independence, it was a country that only needed to add foreign relations to its institutions, not a revolt creating a new country.
On the 18th of September, Norway issued a partial mobilisation and moved 22 500 men to the border. The Swedes replied with their own mobilisation of roughly 100 000 men and pulling together the Swedish navy on the western coast of Sweden - including Sweden's first submarine.
However, the Swedish army, made up of a majority of conscripts since 1901 were less than enthusiastic about going to war against a brethren people and while it was much larger than its Norwegian counterpart, the level of technology were about even - both sides made use of modern bolt-action rifles, modern light artillery, obselete medium artillery and a smattering of machine guns. However, Norway is mountainous and easy to defend, especially by a motivated force defending their homeland. The Norwegian army had since the 1880s build fortifications along the border and trained for a potential war against Sweden, efforts that had increased since the 1895 crisis between the two countries.
Another important factor was the Swedish public opinion. Most Swedes were not willing to shed blood to keep the union going, especially against a brethren people such as the Norwegians. The Swedish unions and the social democratic party was also strongly opposed to military actions against the Norwegians. The unions were emboldened by a victory against the machine industry in june 1905, where the employers had used a lock-out to drain the cash reserves of the unions but were forced to the negotiation table since the unions had worked together and other unions - including the Norwegians ones (!) - were providing money for the metal workers' union.
The unions and the social democrats threatened a general strike in case of war, and agitated that conscripts should refuse orders to advance into Norway.
Finally the negotiations reached a conclusion and the Swedish parliament confirmed the dissolution of the Union on the 26th of October 1905 and King Oscar II abdicated as King of Norway.
To summarize;
Norway was an existing state with its own army, navy, parliament, government, courts and other institutions.
The Norwegian army, while smaller than the Swedish, was ready to defend Norway, motivated and on the same level of equipment and technology as the Swedish. An invasion against the mountainous Norway (that also had recently constructed forifications along the border) would be costly, even if Sweden won.
The overwhelming majority for the independence side on the Norwegian plebiscite caused some among the Swedish unionist to lose hoope saying 'We can conquer Norway, but we can't keep it.'.
The recently emboldened Swedish labour movement, with the unions (which had recently won a victory against the employers, partially due to the support of the Norwegian unions) and the social democratic party and its youth wing were strongly against military action, threatening a general strike and agitating among the conscripts to refuse orders to advance into Norway.
Military action was impopular both among the general soldiers of the army and the general population - none wanted to shed Swedish (nor Norwegian) blood to keep a union the Norwegians had rejected so strongly.
The bottom line was that the Swedish conservative government realised that while they may perhaps take Norway through military action, they could not rule it afterwards, and might face widespread unrest at home if they tried.