I am trying to send my quote to Twitter but get a Blocked Page error - if I use the example ( https://codepen.io/freeCodeCamp/full/qRZeGZ ) I don’t get the error - the code to set the href looks the same. Please advise
My codepen project is https://codepen.io/alanbradnum/pen/vYpBjGr
Many thanks, Alan
It worked when I went to test the tweet functionality, but , you could test target="\_blank"
, and see if it works on your end
I had target="_blank" - I changed it to target="\_blank" but it still doesn’t work
vinyl704:
\
I tried two different things and they both work:
used target=“_top”
used target=“_blank” but ran in debug mode
I’m really confused. Please help
I don’t know whats going on. Your original code worked for me. I remember I ran into the same issue when I first did this project too. Have you tried using a different browser?
It is because the Codepen pens run inside an iframe.
If you want to check that the button works as expected you can use the Debug mode view (Change View > Debug mode).
Here are the docs that talk about the iframe limitation (all Codepen views are inside an iframe except the debug view).
Web Intents
Web Intents cannot be loaded inside an iframe. A Twitter author must view the full webpage before deciding to author a new Tweet or Tweet action pre-populated by your specified Web Intent or follow a specified Twitter account.
_top
is a different context as you can see it opens in the same tab and not a new one. Codepen debug mode is not inside an iframe so _blank
works.
The HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.
1 Like
Thank you for your reply - now it makes sense
Sorry for the delay in replying to you
system
Closed
October 6, 2022, 5:48am
8
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.