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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Chrome

From novice to tech pro — start learning today.