0

Per the Twitter Web Intents documentation, I figure that I should be able to create the following links, and have them properly open a Web Intents window to twitter. The Web Intents window opens properly, however I get the error "Sorry, that page doesn’t exist". Here is what I have done.

I added the following script tag to my Angular template:

<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>

Then, I have an ng-repeat for each tweet, which contains the following code:

<p><a ng-href="http://twitter.com/intent/tweet?in_reply_to={{ tweet.id }}">Reply</a></p>
<p><a ng-href="http://twitter.com/intent/retweet?tweet_id={{ tweet.id }}">Retweet</a></p>
<p><a ng-href="http://twitter.com/intent/favorite?tweet_id={{ tweet.id }}">Favorite</a></p>

For each tweet that is on the page, the proper HTML is generated. In the case that the tweet has the id 431111460186759200, the following html is generated for these links:

<p><a ng-href="http://twitter.com/intent/tweet?in_reply_to=431111460186759200" href="http://twitter.com/intent/tweet?in_reply_to=431111460186759200">Reply</a></p>
<p><a ng-href="http://twitter.com/intent/retweet?tweet_id=431111460186759200" href="http://twitter.com/intent/retweet?tweet_id=431111460186759200">Retweet</a></p>
<p><a ng-href="http://twitter.com/intent/favorite?tweet_id=431111460186759200" href="http://twitter.com/intent/favorite?tweet_id=431111460186759200">Favorite</a></p>

When I click on these links, the proper modal is opened, in the recommended size (thanks to the widget.js file I embedded), with the correct URL. However, instead of showing the Web Intent screen, it shows me the following:

What Actually Happens

Does anyone here have enough experience with Twitter and their Web Intents to help me?

  • Is it possible that the Web Intents stuff has really been down all day? Or is it gone permanently? – frosty Feb 12 '14 at 5:22
1

It's simply because there is no tweet with id 431111460186759200. If you try with the id 431216327143858177 it works fine: https://twitter.com/intent/tweet?in_reply_to=431216327143858177.

If the tweet your code is referencing still exists, try using tweet.id_str instead of tweet.id. For example Javascript can't handle numbers as big as tweet ids so for example 431216327143858177 becomes 431216327143858200. Using id_str you would be sure it works in any language.

And by the way it's better to use https links rather than http ones.

  • OK. So, I have a Java server in the middle. I wonder if it is using ints instead of doubles, and causing this issue. I will look there first. Thanks for the idea. – frosty Feb 12 '14 at 6:27
  • Also, I am using https. In all of the troubleshooting, I switched to http. I will switch it back. – frosty Feb 12 '14 at 6:29
  • Further looking at it, I am almost sure that is it. The ID from the post I am testing with is 430837800020111360, but my server is rounding it to number in my example. All the other tweets are being rounded as well. So, I think that my Java service needs to use a different type. I will work with my backend dudes. Thanks for helping here. – frosty Feb 12 '14 at 6:35
  • Yes..by changing my code to "tweet.id_str"... It worked for me... – Vijaysinh Parmar Jun 4 '16 at 14:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.