You need to use the javascript tags {literal}<script type="text/javascript"> $(document).ready(function() { $('a').attr('target', '_self'); });</script>{/literal}
I tried adding the code under the head tag in the default.master.tpl, for my theme but I get a "Something has gone wrong." error page. {literal} $(document).ready(function() {$('a').attr('target', '_self');});{/literal}