// Get the whole page, right before it's rendered to the browser $source = &$modx->documentOutput; // Syntax to find and replace $strFind = 'target="_blank"'; $strRepl = 'rel="external"'; // Do the thing that finds and replaces stuff $source = str_replace($strFind, $strRepl, $source);
jQuery.noConflict();
jQuery(document).ready(function($){
// Open external links in a new window
$('a[href^=http]').each(function(){
if(this.href.indexOf(location.hostname) == -1) {
$(this).attr('target', '_blank');
}
});
});