twitter sharing not working in codepen
error : Refused to display ‘https://twitter.com/intent/tweet?text=“A%20census%20taker%20once%20tried%…%20beans%20and%20a%20nice%20Chianti.”%20The%20Silence%20of%20the%20Lambs ’ in a frame because an ancestor violates the following Content Security Policy directive: “frame-ancestors ‘self’”.
my codepen : https://codepen.io/vinodhkumarb/pen/mwKbMP
Hi vino, I encountered the same problem yesterday too. But I discovered that opening twitter in a new tab solves the problem. Try using window.open(url).
Hope that helps!
@Fhedra gave you good advice. If you replace your piece of code … window.location… with this one. Your app is going to work.
$('#tweet').click(function(){
window.open('https://twitter.com/intent/tweet?text='+ encodeURIComponent('"' + currentQuote + '" ' + currentAuthor));
});
JESii
November 22, 2017, 2:52pm
4
that did the trick; thanks much!
window.open("https://twitter.com/intent/tweet?text=" + $("#quote").html());
$("#quote").html() is where the quote was on my url.