I have some jQuery code that works quite well for opening external links in new windows, although I am running into compatibility issues with my Joomla site and jQuery. I’ve run into this issue in the past, and the easiest method to resolve it is to use the Joomla system Mootools library.
Here’s the jQuery script I need converted into Mootools:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('a[href^="http://"]').filter(function() {return this.hostname && this.hostname !== location.hostname;}).attr('target', '_blank');
});
</script>
Could someone please help me convert the above code?
Once again, Mootools is already enabled via a system plugin.
If you might want to select external links again you could set up a new pseudo selector
Or exactly as jQuery did it.