javascript - Like button not working in a Chrome extension -


i have implemented simple facebook "like" button in extension. however, not appear working.

i using iframe version of "like" button because won't need scripts.

<iframe src="//www.facebook.com/plugins/like.php?href=[dummy_text]&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;font&amp;blah..." scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowtransparency="true"></iframe> 

at first, button show nicely , correctly:

enter image description here

however, after clicked it, "error" in red:

enter image description here

so thinking maybe because of (kind of stupid and) restricted policies added in manifest version 2?; since works if put on regular webpage. (it says "confirm" after click button.)

enter image description here

any idea on how fix this?

//www.facebook.com/... protocol-relative url. when embed such url on normal http(s) site, url resolves http(s)://www.facebook.com/.... however, in chrome extension, resolves chrome-extension://www.facebook.com/......

to fix issue, prefix url https:, i.e. use https://www.facebook.com/....

after doing that, button still not show because of content security policy. desired result, have allow facebook embedded, relaxing csp via manifest file:

"content_security_policy": "script-src 'self'; object-src 'self'; frame-src https://www.facebook.com", 

(you can whitelist http sites, e.g. using
"script-src 'self'; object-src 'self'; frame-src http://www.facebook.com" or
"script-src 'self'; object-src 'self'; frame-src http://www.facebook.com https://www.facebook.com")


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -