Вопрос

I have the following tweet:

var tweet = "I might actually do a 5K: http://t.co/tXQIYlUt #zombies #running"

And I would like to pass this to the twitter api using js

$('.my_div').append('<a href="https://twitter.com/share?text='+ tweet +'%2Fpages%2Ftweet-button" target="_blank">Tweet</a>')

My JS creates this: https://twitter.com/share?text=I%20might%20actually%20do%20a%205K:%20http://t.co/tXQIYlUt%20#zombies #running&via=JustinZollars&url=

which renders this way at twitter.com:

I might actually do a 5K: http://t.co/tXQIYlUt http://mydomain.com/

notice it cut out my hash tags. how can I sanitize my url?

Resources:

  1. docs

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top