Why does Twitter's Share on Twitter bookmarklet fail so often and how can you fix it?
Why does the Share On Twitter bookmarklet no longer work on Wikipedia?
This is the url for the Share On Twitter bookmarklet: https://dev.twitter.com/docs/share-bookmarklet
This is the code:
javascript:(function(){window.twttr=window.twttr||{};var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;if(C>A){G=Math.round((C/2)-(A/2))}window.twttr.shareWin=window.open('Post a Tweet on Twitter',,'left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');E=F.createElement('script');E.src='Page on twitter.com';F.getElementsByTagName('head')[0].appendChild(E)}());
It fails on Wikipedia, it fails on Google, it failed trying to share the url that's its on, Share Bookmarklet.
The Share window opens but the textbox that should hold a title or highlighted text and the url is blank.
It has worked on Wikpedia pages, but only once or twice. It seems to fail almost totally on any domain it fails on and work right on the other domains.
Just knowing if the bookmarklet works or not on Wikipedia would be of some value.
Wszystkie odpowiedzi (2)
I dragged the gray button from that page to my Bookmarks Toolbar and it worked for me on 1 Wikipedia page. At least as far as calling up and filling in the form -- I wasn't logged in so I didn't take it any further than that.
Oh wait, I tested with Wikipedia on http. When I switch to https, the form does not populate. If you compare the URLs you can see the difference:
From HTTPS: https://twitter.com/intent/tweet
Since referrer information can only pass from a secure page to another secure page, you need to edit the code of the bookmarklet by changing http:// to https:// where it appears.
By the way, I suggest getting the current button, since your code does not match. If you drag and drop, you can right-click and access Properties to make the edits (yes, it's inconvenient in the little box). If you use the code from the page, change the
if(C>A)
to
if(C>A)
in order to make it work in Firefox.