Including both Tweet Button and Profile Widget


I have a situation where I need to include a Twitter profile widget and a Tweet button on the same page. Take the following testing example:

new TWTR.Widget({ version: 2, type: 'profile', rpp: 4, interval: 4000, width: 285, height: 260, theme: { shell: { background: '#ccc', color: '#333333' }, tweets: { background: '#ffffff', color: '#3d3d3d', links: '#0066CC' } }, features: { scrollbar: true, loop: true, live: true, hashtags: true, timestamp: true, avatars: false, behavior: 'default' } }).render().setUser('westlywright').start();
        //Twitter JS Func for sharing
        window.twttr = (function (d, s, id) {
            var t, js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s);
   = id;
            js.src = "";
            fjs.parentNode.insertBefore(js, fjs);
            return window.twttr || (t = {
                _e: [],
                ready: function (f) {
        }(document, "script", "twitter-wjs"));

        twttr.ready(function (twttr) {
  'click', function () {
                //some jquery here
        <a href="" class="twitter-share-button" data-lang="en">Tweet</a>

I am getting the following error I am guessing because the two widget.js files are conflicting:

Uncaught TypeError: Object # has no method ‘ready’

Does anyone know how to resolve this?


The two scripts are incompatible as both compete in the “twttr” namespace. Is there any fix or workaround in sight?


Mi sono scritto oggi sto provando come funziona…

closed #4

closed #5