How To Redirect After Someone "Likes" your website

agent01

BANNED
Joined
Apr 15, 2010
Messages
124
Reaction score
48
How do you redirect someone to another page after they "like" your website page?
 
if you're talking about the facebook like button then you can't because they are clicking an iframe of facebook so they are clicking inside a new DOM
 
if you're talking about the facebook like button then you can't because they are clicking an iframe of facebook so they are clicking inside a new DOM

ive seen it redirected on 25 different "like" pages...it is possible
 
Use setInterval() to poll to see what the active element is every 50-100ms. If the active element is the Facebook Like button, use setTimeout() to schedule some more Javascript to run in 50ms (like document.location = "whatever").

You may want to delay for more like 1-2 seconds to give time for the Like request to finish being processed on Facebook's end.
 
I'm not great at javascript or web dev in general but it's incredibly easy to run some code when someone clicks the like button. You might do a bit of the old document.location = "whatever" or whatever you like when they click like.

It's not exactly what you're looking for but I personally use it to show content when they click like at the same time as hiding the like button so they don't unlike it... I just make one div visible and one hidden when they click like.
 
Last edited:
Back
Top