Catch click event (window.open) on HTML content

Hi everyone,

is there a way to catch a click Event on dynamically loaded html content?

I do load HTML content from a server on detail pages of articles including links within the content. Is there a way to catch the window open event, manipulate e.g. the link data by adding custom params, trigger additional tracking functions etc. and than trigger the window open event programmatically afterwards?

I know that i can not bind custom events to dynamic html content with Ionic/Angular 2, but maybe there is a way to catch the general window open event on links.

Any help would be appreciated.

Best regards
Greg

In case anyone is interested in how i solved the problem:

I did use a HostListener, which captures any click events in app. Than I do disable the default behaviour of the link to be opened and instead access the parameters via typescript, do some checks (e.g. regex if parameter is a number or regular link) and trigger the event manually.

public handleKeyboardEvents(event,targetElement) {
event.preventDefault();
	
	if(targetElement.nodeName == 'A'){
		var parentElement = targetElement.parentElement;
		var parentAttributes = parentElement.attributes;
		for(var i = 0;i < parentAttributes.length;i++){
			if(parentAttributes[i].name == 'linktarget'){
			 var regexp = new RegExp('[0-9]{1,5}');
			 var internalLink = regexp.test(parentAttributes[i].nodeValue);
	
			 if(internalLink){
				this.navCtrl.push(DetailsPage, {
					article: newObject
				});
			 }else{
				  if (typeof (window.open) == "function") {
						window.open(parentAttributes[i].nodeValue);
					}
					else {
						window.location.href = parentAttributes[i].nodeValue;
					}
			 }
			 
		  }
		}
	}

}

where to keep this code and in which file. ?
and how to replace default error page of Website i.e. " Webpage is not available " with our custom alert.