Yesterday afternoon, while adding a social bookmarking tool from ShareThis, we came across the following JavaScript error that just wouldn’t go away, even though we were using the same code snippet as is shown on the ShareThis example pages.

SHARETHIS is null

I don’t know how many different things we tried to get it to work, but safe to say we wasted more than enough time for what it was worth! :)

The solution? For some reason, this tool barfs when running from localhost if you are not using the actual IP address. In our case, we were running the site off http://localhost/sitename. ShareThis will only work locally if you use the IP address for localhost, like so: http://127.0.0.1/sitename.

This was a wierd one and really there is no reason why it shouldn’t work with localhost. Hopefully those ShareThis guys will GetThis and save future developers a whole lot of headaches!