There are quite a few programs nowadays that are good at blocking pop-up windows and ads. But I also think it is useful to use programs like
WebParanoid This is a very convenient and user-friendly software which perfectly copes with its function of protecting against malicious sites.