With jQuery, you can have outside links open in a new tab/window with this:

$(function()
{
        $('a[href^="http"]')
                .not('[href*=' + window.location.hostname + ']')
                .attr('target', '_new');
});

If you'd still prefer not polluting the DOM with that, you can instead
explicitly create a new window (with dimensions, attributes, etc.)

$(function()
{
        $('a[href^="http"]')
                .not('[href*=' + window.location.hostname + ']')
                .click(function(e)
                {
                        // new window code here

                        e.preventDefault();
                });
});



On Sat, Jun 20, 2009 at 10:50 AM, Bankai<hgnelso...@gmail.com> wrote:
>
> How can you do this in a XHTML Strict environment? Target=blank doesn
> ´t validate.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to