Even disabling scripts and whitelisting trusted sites may not save you, because everybody seems to want to get in on ad revenue, even respectable website operators. Those ads are managed by a third party, so the host rarely has any control over content.
But you think "I'll just never click on any ad, anywhere, and therefore be safe". As users avoid ad links, advertisers just get more clever in obfuscating them. You can be misled into thinking you're clicking on a legitimate related page, and that trend is just starting to take off. Wait until somebody figures out how to embed malware in a YouTube video.
I have, however, not previously heard of ransomware infections via web pages. If that's the case, then this is an entirely new attack vector. The latest (and most widely dispersed) version, called "
Locky" is still propagated via email attachments. I've been getting as many as 30 emails per day that claim to have an invoice attached, which is Locky's M.O.