Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird Trailing Slash at End of Twitter Message

I am using the following code to show a page with a Twitter box already filled in with a message:

<a href="http://www.twitter.com/share.php?url=http://myurl.com&text=myMessage" target="_blank">Click me</a>

However, on the page, I am getting this inside the Twitter box:

myMessage/

Note the trailing slash. Any ideas how to fix this?

like image 579
steacha Avatar asked Feb 14 '13 21:02

steacha


3 Answers

We have found a workaround for this, where you add the source=webclient parameter, crucially, to the END of the twitter address. When you do this, Twitter no longer adds the trailing slash. However, given how Twitter like to change their formats and codes around, there's no guarantee this will work forever :-)

For example...

<a href="https://twitter.com/intent/tweet?text=http://www.rsc.org%2FEducation%2FEiC%2Fissues%2F2013January%2F50th%2Delement%2Dtin%2Easp&amp;source=webclient" target="_blank">Twitter this</a>
like image 129
Andrew Wiseman Avatar answered Dec 28 '22 08:12

Andrew Wiseman


No, the solution is more simple. URL-encode your url :

https://twitter.com/intent/tweet?text=myMessage&url=http%3A%2F%2Fmyurl.com
like image 25
David VANTYGHEM Avatar answered Dec 28 '22 06:12

David VANTYGHEM


Add a trailing slash to your URL and that should go away. It worked for me.

Change the URL from this:

http://www.twitter.com/share?url=http://myurl.com&text=myMessage

To this:

http://www.twitter.com/share?url=http://myurl.com/&text=myMessage
like image 28
tnylea Avatar answered Dec 28 '22 07:12

tnylea