kkick
kkick

Reputation: 35

Intercept links outside of current domain and sub-domains

I am trying to make any link that is not internal show as a popup/new window. The data is user entered and pulled from a database. Any help is appreciated.

Thank you!

Upvotes: 1

Views: 118

Answers (1)

Jake Feasel
Jake Feasel

Reputation: 16955

Use jquery:

$(function () {

 $('a:not([href^="http://www.mysite"])').attr("target", "_new");

});

Upvotes: 1

Related Questions