Malware is also served up through compromised ad services. So going to legit sites can still lead to a phone getting malware. Mobile ad networks are usually worse than the regular web.
I suggest after wiping the phone, to install a good adblocker and to use a browser that blocks ads by default. I personally like using the Ghostery browser.
If you are also worried, make sure that you have it set NOT to allow installation of apps from unknown sources.