Question

I use content_scripts in chrome extension to catch the event of opening new site. But when i click on this site a link that redirects me to subsite the event is not fired.

It's not usual site that uses reload to handle link clicks. After clicking link i'm redirected to something like (AJAX?):

http://somesite.com/page#something

So i suppose it's dynamically loaded. How to handle all events of reloading of this page?

How to catch every event of loading page not only by entering into URL field but also by clicking links?

Was it helpful?

Solution

You are going to have to hook the mousedown event. With JQuery it looks like this:

$('a').mousedown(function(){
alert($(this).attr('href'));
});

You'll have to examine the value of the href for $(this) and then do whatever you need to do.

Sounds like the page you are working with has frames so you need "all_frames": true in your manifest under the content_scripts section.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top