I am writing a javascript script from which I am detecting user activities in current site. So in that site user can click on box which throws them to new tab with a link . that link is dynamic.
i need to record that link in my DB which is opened in new tab,Also i don't know whether it opened from clicking on or any other function..in my case a function is called on click of button then new tab is opened with link i.e window.open(data.link) is called on the function click
Is there any way to call a function whenever a new tabs open from current page?
Update
below answer did help me for tracking links with target _blank but it didnt work when target is not present. Also, in my case as i've deccribed that tab is opening from functions too so i solve it by overiding window.open function i.e
window.open = function(url, name, features, replace) {
alert("opening a window");
// do other stuff here}
this event is called whenever new tab is opened from window.open function!!
Hope it helps other too!