Unhealthy foods will be prohibited from advertisement online and before 9pm on TV in a bid to reduce children's exposure to junk food and tackle obesity.