Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post tweet with new line inside it

I know that twitter says that users should not use new lines inside tweets because it depends on the client if it are shown or not, but im coding an app that draws tweets into the twitter timeline aLa http://www.drawatweet.com . So its a must.

The thing is that after i tried all the possible ways of doing this i cannot force the tweet to be split in multiple lines. I had revised how they post it, and sending the exact same "newline" code it doest not show as drawatweet.com does.

I have tried using the twitter api and the twitter intent tweet page without success.

Another example its http://www.preservatweets.com/ that use multiple lines for showing a message, and, again, i use the same mechanism but my new lines dont work.

I came to think that Twitter has some arrange with this "apps" and that its being check by the referrer. I know that this sounds crazy, but i cannot find another logical answer. Does somebody knows how it work?

UPDATE

There its no possible way to use new lines in twitter. What i have todo is to generate really large strings (without spaces inside) and the new line (or space), will force a new line if both strings are unsplittable.

Thanks in advance gonzalo

like image 268
Gonzalo Avatar asked Feb 27 '13 20:02

Gonzalo


1 Answers

Easiest way to do this is..

var msg = "This is a test message. \n is used for new line character.";
var twitterHref = "http://twitter.com/intent/tweet?text=" + escape(msg);

and then set it dynamically as href for your <a/>.

like image 60
Dipen Dedania Avatar answered Sep 29 '22 18:09

Dipen Dedania