Weird Error when Adding ShareThis Hovering Buttons to Rails

Hi all,

I am trying to add the ShareThis Hovering buttons to my Rails 3
application but have no luck. I got the embed code from In order to
prove that the problem is specific to Rails, I put the same code into
a HTML file outside the rails app and also a pure HTML file inside the
public directory (without routed to controller) of my rails app. It
turns out that the HTML file outside the rails app works but the one
inside the public directory threw an error "Uncaught TypeError: Cannot
read property 'length' of undefined" at load.js:1 (obtained by google
chrome error console).

Any help will be appreciated!



I bet no one wants to have to go to a site, agree to licensing
agreement, and then fill out a form so they can help you with your
problem. The morale of the story is: if you want help, make it easy
for people to see your problem


I believe I provided all the information I could in my last email. I
admit that I should attach the source code. So here it is at I put this piece of code (without any
other line of code) into two files - one outside my rails app
directory and another one in the public directory. In the end, only
the one outside the rails app directory works so I believe this
problem is pertaining to the rails framework. Note that I didn't even
route to a controller to render the view.

I am sorry for not structuring my question properly in the last email.
I am new here, please have mercy on me =)


JS is client-side code, and nothing to do with Rails. *but* I would be
looking at the source-code generated by Rails to see if any other
javascript files are being included which might conflict with your
"sharethis" files.

Essentially, I'd be viewing the source of the two files (one Rails
generated and one not) to look for differences, because something in
there is confusing your browsers...

Try using Firebug in firefox to display the page and see if it shows
any errors. Also check the html is fully valid using the w3c html


The problem is with the domain name as loader.js tries to do a split on
the domain name. So if you are hitting the page localhost:3000 which has
the sharethis widget it will not show up as it cannot split localhost.
However if you map your machine( to something like a.b then
loader.js can split it and the ShareThis widget will show up.