To prevent the pop-up virus from happening again, you can block them. You can go to Safari settings and block pop-ups.