Twitter web intent URL encoding not working
If I take out the %20's from my URL then it works...
But I need to keep those spaces in there.
var text = encodeURIComponent("40% Off Prom Tuxedo Rental"); var couponURL = encodeURIComponent("http://example.com/coupon/?ref_name=Test Name&school=Test School"); var twitterURL = "https://twitter.com/intent/tweet?text="; var twitterURL = twitterURL+text+"&url="+couponURL;
In this situation, a percentage sign equals %25, so if you want to include the spaces in your tweet link, use %2520 instead of %20. So wherever you were going to use %20, use %2520 instead.
var text = "40% Off Prom Tuxedo Rental"; text = text.replace(/\s/g, "%2520")