The appearance of fake news on websites and social media has inspired scientists to develop a "vaccine" to immunise people against the problem.