Random Quote Machine_twitter link problem

I have been working on the Random Quote Machine Project. I usually work first on “Brackets” in my own computer and then I copy it to codePen. Now that I have tried it on codePen it seems that the twitter button doesn’t work for some reason… Anyone knows why?

Thank you for your help! And if you have any comment regarding the project, please say something!

Try using .prop instead of .attr.

The difference between attributes and properties can be important in specific situations. Before jQuery 1.6, the .attr() method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior. As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() retrieves attributes.

Thank you for your help! Unfortunately it still doesn’t work. Like I said, it works pretty well outside of codePen. It just doesn’t work on codePen. :confused:

Welp, the console is always your best friend then.

“Load denied by X-Frame-Options: https://twitter.com/intent/tweet?text=There%20are%20two%20ways%20to%20slide%20easily%20through%20life:%20to%20believe%20everything%20or%20to%20doubt%20everything;%20both%20ways%20save%20us%20from%20thinking.%20%20-%20Alfred%20Korzybski does not permit cross-origin framing.”

(I got around it by using window.open() instead of changing attributes or links :3)

Well… now I have another problem!! The quotes doesn’t work too! The console says:

“jquery.min.js:4 Mixed Content: The page at ‘https://s.codepen.io/boomerang/51792b7cdbd1a73afef1e3ff8de28b9e1479935192571/index.html’ was loaded over HTTPS, but requested an insecure script ‘http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=jQuery3100896400028452591_1479935193079&_=1479935193080’. This request has been blocked; the content must be served over HTTPS.”

I hate codePen!!!

https://codepen.io/iospadov/post/when-cors-got-your-json-down-using-jsonp-to-avoid-blocking-of-cross-origin-requests You can read this for that error :stuck_out_tongue:

Thank you so much for your help!! Just one more question. Do you know why the twitter link doesn’t work? With window.open() it works, but I just don’t understand why it can’t work the other way :confused: