Reputation: 1489
So I have a script like this now: popUp("https://twitter.com/intent/tweet?text=" + greeting + poem + " -&url=" + siteURL, 704, 260);
The "poem" is a haiku and I'd love to have it like: line1 line2 line3
rather than line 1 // line 2 // line 3, which it is now. I tried inserting stuff like \n in there to no avail. "Poem" is constructed simply like line1 + " // " + line2 ...
Upvotes: 20
Views: 11756
Reputation: 171
Use "%0A" for line break in the url directly. \n doesn't work in the url bar.
Upvotes: 0
Reputation: 328


Creates a line break on twitter if you're posting from the HTML form. You'll need to remove the spaces in bewteen the characters, I couldn't figure out how to make the answer not escape to a newline. Irony alert
Upvotes: 3
Reputation: 887225
As you've guessed, newline characters cannot appear in URLs.
Using a random escaping mechanism won't do you any good; you need to URL-encode the newline:
https://twitter.com/intent/tweet?text=abc%0adef
Upvotes: 35