Quote Machine Tweet button doesn't work on CodePen due to Twitter's API
See original GitHub issueDescribe your problem and how to reproduce it: The Tweet button on the Quote Machine project isn’t working due to twitter.com refusing to connect and a ERR_BLOCKED_BY_RESPONSE error. User story 10 in the instructions for this project states
I can tweet the current quote by clicking on the
#tweet-quote
a
element. Thisa
element should include the"twitter.com/intent/tweet"
path in itshref
attribute to tweet the current quote.
So I did some digging in Twitter’s web intents documentation and found that web intents cannot be loaded inside an iframe (about halfway through Working with Web Intents section).
I looked into how CodePen renders its projects, and in both the editor and full views, it renders as an iframe. Since the user has no control over Twitter’s rules, or how CodePen renders the project, I don’t know how a tweet button could be successfully implemented in this project. Maybe posting to another social media site could be implemented instead?
Add a Link to the page with the problem:
- FreeCodeCamp quote machine instructions
- FreeCodeCamp official example
- Twitter documentation for web intents
Tell us about your browser and operating system:
- Browser Name: Google Chrome
- Browser Version: 86.0.4240.111
- Operating System: MacOS Catalina (10.15.6)
If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box):
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:15 (10 by maintainers)
Top GitHub Comments
I think @moT01’s suggestion of adding a hint is a good approach here. Something like:
Even doing what is mentioned in that note at the bottom, I am still having this issue. Twitter is blocked if I just click the button whether target=“_blank” or target=“_top”. If I right click, and then click “Open in new tab”, it opens in a new tab without a problem, regardless of the target attribute.