jScript new tab

Discussion in 'Water Cooler' started by tech, Mar 25, 2010.

  1. tech

    tech Regular Member

    Joined:
    Jun 13, 2009
    Messages:
    490
    Likes Received:
    11
    Im making a similar service to AddThis but im having one problem..

    The whole script and posting to the selected sites works fine and it loads really nice in a jquery popup however when clicking for example on twitter it just goes to twitter, I would like it so it opens in a new tab the code im using is:

    Code:
    $(document).ready(function(){
    $("a[sharewith]").click(function(ev){
    var rel = $(this).attr("sharewith");
    var url = encodeURIComponent(self.location.href);
    var title = encodeURIComponent($("title:first").html());
    rel = rel.replace("{url}",url);
    rel = rel.replace("{title}",title);
    self.location.href = rel;
    return false;
    });
    });
    and thats gets the url + title and shares it with sharewith="link here" and works fine, however how do i get it to open in a new tab?

    ive tried target="_blank" on the html, jQuery – Open External Links In New Window/Tab | blogt0sk1, Open external links in a new tab/window using jQuery

    ive also tried other stuff such as:

    Code:
    var rel = $(this).attr({ target: "_blank" });
    anybody know any other possible ways?
     

Share This Page