How did Norway become a constitutional monarchy?

in 1905 the majority voted for monarchy after the separation from Sweden