[HELP] Twitter is blocking my request to tweet

I was doing the challenge of Random Quote Machine and created this pen

Everything looks perfectly fine, except for one thing. When I click the tweet button, it generates an intent in this format.

While clicking the link in a new tab, works perfectly fine,

but, inside the app, it gives the following error:


Here’s my code. How can I overcome this error?

P.S: Any feedback regarding the project (from design to optimization) is highly appreciated.

you can’t, as that is how Twitter limit that feature - it doesn’t allow to do it in an iframe, which is what codepen uses to render the page

you can see if adding target='_blank' or target='_top' to the a element makes it open in a way that Twitter likes

I had target="_blank" but the result was same.

As long as the code is running inside an iframe it won’t work. But that is not how you would normally run it.

You can see it working if you use the Debug View. Click the View button to the right of the Settings button and click the Debug mode menu item. The page will open in a new tab without the iframe and the tweet button will/should work as expected.

Hi, Thank you for your help.
I have hosted it on github. It’s working absolutely fine.
Probably there’s some restriction in codepen.

Speaking of which, can we share the github project link, instead of codepen link for certification purpose ?

As said, the normal views in Codepen are running inside an iframe.

If you mean a GitHub page that would be fine. But if you try to submit a repo you will get the message “Remember to submit the Live App URL.”. So it has to be to a live working site.

1 Like

Thank you for your help . :smiley:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.