pinterest / widgets

JavaScript widgets, including the Pin It button.
Other
211 stars 88 forks source link

iOS safari with Pinterest app not pinning properly using PinUtils.pinOne() #65

Closed dan-silk-discovery closed 8 years ago

dan-silk-discovery commented 8 years ago

I have this code below (modified to show values instead of variables). This works perfectly fine on a desktop browser, but devices with the Pinterest app don't work properly. I get

PinUtils.pinOne({ url: 'http://www.food.com/recipe/liisas-best-banana-nut-bread-79387?soc=socialsharingpinterest', media: 'http://img.sndimg.com/food/image/upload/h_240,w_320,fl_progressive,c_fit,q_92/v1/img/recipes/79/38/7/fhzY7SGQF23fNdrRMKfX_Banana%20Bread%201.jpg', description: 'Banana Nut Bread' })

It seems the problem is URLs with URL-encoded characters are breaking something in the app. The image doesn't show up in the example above.

dan-silk-discovery commented 8 years ago

The image URL I get already has %20 in it. I tried decoding that, but it didn't work. I then tried encoding the entire URL and that didn't work. The solution was to replace %20 with %2520 which seemed counter-intuitive to me, but if it works, it works.

plasticmind commented 8 years ago

I'm not sure if it's the same issue, but I spoke with @kentbrew on Twitter about problems with iOS Safari pinning, and I think he's resolved this problem.

Here's the conversation on Twitter.

kentbrew commented 8 years ago

I suspect it's the commas in the media URL, which are supposed to be percent-encoded when set as URL parameters. It sounds like you found an answer, so I'm going to close this.