How to get all anchors to open in new window with inappbrowser?

I’m using this:


document.onclick = function (e) {
e = e || window.event;
var element = e.target || e.srcElement;

    if (element.tagName == 'A') {
        window.open(element.href, "_blank", "location=no");
        return false;
    }
};

But I need to get the anchor from a specifically tag like or any id

thanks.

window.open(element.href, "_system")

Also, i wouldnt use that window hack. It’s probably best to create a directive for this.

Thanks Ash, but how can I create a directive for this?