You can block Safari Pop-ups using a couple of ways. On your MacBook, the best would be to empty your cache and clear your history and website data. This will remove any weird stuff that makes your browser act up.
Click on Safari > Advanced > Scroll own to the bottom and choose ‘Show Develop Menu’. When you do this, you will find a Develop menu item on your Safari. Click on it and then choose ‘Empty Caches’.
If you are having the issue on your iPhone or iPad and are running iOS 10, Tap on Settings > Safari > and enable ‘Block Pop-ups’. This is an option in the GENERAL area of your Safari settings.