Intercept websites JavaScript with Chrome extension?

How to intercept websites JavaScript in Chrome... basically I want to prevent JavaScript links that open in a new window on all or specific websites. Because usually these types of links are spam.

There are extensions for Chrome which allow you to inject JavaScript (like "Custom JavaScript for websites"), but is it possible?
intoxicated_curveballAsked:
Who is Participating?
 
bbaoIT ConsultantCommented:
what's your ultimate goal of the question?

to block spam links on pages shown by Chrome? if this is your goal, you really no need to do the same thing in a complicated way. just install an extension like NoScript to stop JavaScript of specific sites, AdBlock to stop ads from known sources.
0
 
intoxicated_curveballAuthor Commented:
The ultimate goal is as I said "prevent JavaScript links that open in a new window on all or specific websites".

Disabling JavaScript is not a solution because it makes most  websites no longer function effectively. It is needed to intercept any function or event listener that wants to open links in new windows and block them... some how.
0
 
bbaoIT ConsultantCommented:
> that wants to open links in new windows and block them

this is exactly what adBlock does. it will block links of any webpage according to given rules and patterns (wildcards).
0
 
intoxicated_curveballAuthor Commented:
I have tried all the major ad blockers (i.e. Ad Block, Ad Block Plus, Popup Blocker Pro, etc), they don't work in certain sites.

Since the popup links are completely random, how do you propose I block them using a pattern?
0
All Courses

From novice to tech pro — start learning today.