Confirm prompt for external links
$('a').filter(function() { return this.hostname && this.hostname !== location.hostname; }).addClass("external"); $('a.external').attr('onclick', "return confirm('You are clicking on an external link')");