Dude, don't go to shady places. Freeones, a few of the popular "tube sites", official sites...if you stick to these, you'll be fine 99% of the time. For the other 1%, just keep a good anti-virus handy.
Additionally, if you have Firefox, get Script-blocker. Only what you want to run will be able...