Posting both an url and an image using purely javascript from my own website


I’m new to Twitter so I’m surely asking for a simple question :–)

I’m looking for a simple sample of Javascript code I can place on my website that posts a link and an image to the Twitter account of the currently Twitter logged user.

Right now I have this:

Share on Twitter !function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0];
        if (!d.getElementById(id)) {
            js = d.createElement(s);
   = id;
            js.src = "";
            fjs.parentNode.insertBefore(js, fjs);
    }(document, "script", "twitter-wjs");
Problems? Yes, some browsers block the popu, IE after I allow the popup launches a new browser full size which is surely not what I wanted to see.

Now, I didn’t have these types of problems when dealing with the Facebook Javascript Api, so I wonder if I’m doing something wrong here or maybe the problem lies because the api call is made from the link and not from a direct Javascript script based call ??

Ideally I would prefer to have a javascript-only based solution that would NOT rely on an tag specific Twitter button (as I’m not sure if this is what causes all the problems) Is that possible? If not, what’s the right way to avoid all the issues and have it working?

Please help !!!
and thanks in advanced.