Javascript opens a new window and loads _self

This code loads the href into a new window and into itself, why is that? Should not return false; stop click by default?

//get links in paragraphs
var first_p = $$('#client_work p a');

//get first link
var client_link = first_p[0];

if(client_link) {
    $(client_link).observe('click', function() {

        var mylink = window.open(client_link.href, 'new_window', '_self');
        return false;   

    })
}

      

+2


a source to share


1 answer


try it



//get links in paragraphs
var first_p = $$('#client_work p a');

//get first link
var client_link = first_p[0];

if(client_link) {
    $(client_link).observe('click', function(event) {

        var mylink = window.open(client_link.href, 'new_window', '_self');
        Event.stop(event);   

    })
}

      

+3


a source







All Articles