Build a random quote machine - twitter sharing is not working please help me

Build a random quote machine - twitter sharing is not working please help me
0

#1

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


#2

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!


#3

@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));
               });

Error sending Tweet
#4

that did the trick; thanks much!


#5

window.open("https://twitter.com/intent/tweet?text=" + $("#quote").html());

$("#quote").html() is where the quote was on my url.