Its simple
As long as
1) people don't learn to protect themselves on the internet by using appropriate safety tools, and by practicing safe browsing
and
2) people expect internet content to be FREE, so requiring adverts to pay for the content
then we will never be free of this kind of thing
If you use software which protects you from adverts, popups and scripts you'll be safe. If you don't, you won't