Domanda

Ho il seguente tweet:

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

E vorrei passarlo all'API di Twitter usando JS

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

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

che rende in questo modo su twitter.com:

Potrei effettivamente fare un 5K: http://t.co/txqiylut http://mydomain.com/

Nota che ritaglia i miei tag hash. Come posso disinfettare il mio URL?

Risorse:

  1. Documenti

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top