hookedonwinter
hookedonwinter

Reputation: 12666

Client side Facebook "like gate" without https

I'm trying to set up a "like gate" where a user has to like a page before seeing certain content on a website (not on Facebook itself). I've found some great resources on SO an elsewhere on how to do it, but I'm running into an issue with http vs. https. My site is not loaded over https, but the Facebook login popup is. The error:

Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://yoursite.com" from accessing a frame with origin "http://static.ak.facebook.com". The frame being accessed set "document.domain" to "facebook.com", but the frame requesting access did not. Both must set "document.domain" to the same value to allow access.

I'm currently using the code here: https://github.com/vavrecan/facebook-fangate, but have also found this answer useful.

How can I show a user content only if they've liked a specific Facebook page, without using https?

Upvotes: 0

Views: 137

Answers (1)

Tobi
Tobi

Reputation: 31479

Like-gating is discouraged via Platform Policies, and Like-gates via SignedRequests will stop working on November 6th 2014. Have a look at my answer at

How to check if people liked my Facebook FanPage

The error itself is about CORS and not HTTP vs. HTTPS imho.

Upvotes: 1

Related Questions