Hi there,
I’m having an issue with sharing the quotes on Twitter; when I click to share the link takes me back to my own page at codepen, is there anyone that can help, please. Here is the link to project!
Your twitter button works for me.
It seems to work in Chrome but not in Firefox.
EDIT: My bad, it works on both, but not with the first quote, because you only set the url when the button “#new-quote” is clicked.
Thanks for teaching me CSS fade-ins and gradients btw. ^^
Does it actually take you to twitter with the quote ready to be twitted? because It keeps sending me back home I tried with both chrome and firefox, hmm, weird. thanks for response.
Yes, except for the first quote.
Maybe the popup gets blocked for you?
But for me still doesn’t I tried with firefox too, still keeps sending me to home. It’s interesting actually. thanks for response tho mate.
It resends me back to THIS PAGE it’s a boomerang page.
It opens in a new tab?
After I went to boomerang link, I clicked again on twitter Icon and now worked! I think it was a server bug, or browser issue, thanks for the help. For the first quote that I hard coded do you know how can I make that shareable as well?
You can either add this below your code (or somewhere else, as long as it runs directly):
$.getJSON(api_url, getQuote, 'jsonp');
Or if you want to keep your own hard-coded quote (since it fits the background-color or for whatever reason):
var firstQuote = "Not all treasure is silver and gold, mate.";
var firstAuthor = "Captain Jack Sparrow";
$('#tweet').attr('href', 'https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=' + encodeURIComponent('"' + firstQuote + '" ' + firstAuthor));
Or you can hard code the href
yourself ofcourse.
Thank you so much for your help mate.