Education and Common Sense. Explain to them what can happen and what they might come across.
Nothing you can do will be 100% effective. Many years ago when the Dancing Baby first came out my grandaughter was mad on him so we were searching for sites and a porn one came up. I quickly shut it down and luckily she was to young to understand but since then I have made sure she is aware of all the possible dangers.