Twitter button not rendering


When I create a follow me on twitter button on, I get text only on the web site. How do I get the button to appear?


i have the same problem… just the text appear…

with firebug extension i have one error :

An invalid or illegal string was specified
(function(a,b){function O(a){for(var b…cument.body.firstChild);return c})});


No body know why ? :-/


Can you post the code you’re embedding in your HTML?


Just :


that’s all… :x


This works for me. Make sure you’re not loading the page from a file:/// URL. If you have a public page which I can test, it would help me try to find the issue here.


Hi !

I’m facing the same problem when using the standard “tweet button” code snippet. This problem might be browser independent (and thus website-dependent) as other twitter buttons do appear correctly on other websites on the same browsers / machine.

Some more information :

  • Firebug returns “An invalid or illegal string was specified” in file widget.js line 1 (but it is undebugable as the js file is minimized),
  • Safari’s web inspector returns “INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable.” (same file, same line).
  • the website is written in XHTML 1.1
  • I tried with both text/javascript and application/javascript mime types (as text/javascript is not XHTML 1.1 compliant) but this has no impact.

Example URL : (the button is supposed to be below the right-side menu, however only the link’s text “Tweet” appears)

TY in advance for your help !

P.S. is there a non-minimized version of widget.js ? It would help greatly debug this.


Script tags are not self-closing, so instead of <script … />, use <script …></script>


Thank you for your reply.

Unfortunately, It does not help. I first tried with the original snippet which uses . I put the original tag back. I also unminified widget.js for debugging purpose, and narrowed the problem to the folowing part of the code :

__twttrlr(function (using, provide, loadrunner, define) { provide("util/iframe", function (a) { var b = document.createElement("div"); a(function (a) { b.innerHTML = '

It seems that there is a undefined variable on the line starting with “b.innerHTML”.


One more thing : I displayed, then copy-pasted the source code of the page into a blank fresh .html file (i.e. pure html, no php / smarty templates interpretation), adapted the existing “application/javascript” mime types of the page (which are not related to the tweet button at all) to “text/javascript” and displayed the result in my favorite browser… guess what ? the button is displayed correctly…

I then (for test purpose) server-side forced my site to declare content-type as “text/html” instead of “application/xhtml+xml” and again, with no other modification, the button is displayed correctly.

Therefore it must be somehow related to XHTML headers / how DOM is handled when content-type is XHMTL, but I have no clue how to fix it and why I have this bug.


Did you wind up changing the doctype/content-type of your page? I revisited today and found the button working.


I also have this problem, you can see it here:
www . enhancementresearch . com

My code is:

Follow @EnhancementMale I'm not sure how to force my site to server-side declare the content-type as text/html otherwise I would try it too... please help.


A week without any reply, huh? Well I never did figure out how to get it working the javascript way, but it seems the iframe way ( works just fine


I believe I have a similar issue. However, mine seems to occur randomly. I.e., perhaps 6 or 7 out of 10 times only the “Tweet” text will display where the entire button should, but the remaining times it renders correctly. Unfortunately, I don’t have a public version of this available for people to test, but has anyone figured out what causes this? Could it have something to with the fact that my development site is closed to the public, i.e. a password is required? Thanks for any help!


Same problem with text-only link, but found a simple cause and solution that worked for me.

When I copied and pasted the code, my text editor wrapped the text wrongly, inserting line breaks in the wrong places (breaking the code).

I went back and manually pressed enter at more appropriate places in the code. For example, before a bracket { or after a semi-colon ; The button image shows up now and the code works.

Follow @HiveTasks


The problem is that the js.src is not a real URL.





That worked for me even when I was testing locally and from a file.


I took your code and it still didn’t work for me, but by looking at it more carefully, I noticed that the js.src didn’t have ‘http:’ in front of the URL. That’s what got it working for me.

Follow @MoneyBibleORG


It’s working for me also. The thing of the http and how the script block is appearing “made the trick€” :).

My code snippet is as follows:


Thanks!!! I was pulling my hair out with this thing.


I also am having the problem where the graphic doesn’t appear, just a text hyperlink , which appears to work correctly. This is the code I’m using:

Follow @johncwilkinson


This worked for me, thank you very much sir