Don't click on random links on the internet. Use uBlock Origin, anti pop-up extension, Privacy Badger, Anti-Malware software.. And if you're encountering it in Google Chrome (or any other browser), you might want to search through the settings to remove any suspicious links stored in there (or extensions?), under cookies /default page/ notifications etc..