Help needed please: The Like button on Facebook

by 6 replies
7
Hi there

I am trying to redirect my visitors when they click on the Like button.

I am using this bit of code but it doesn't seem to redirect. Just brings the visitor back to the same page. Any ideas please?

<script type="text/javascript">
top.window.location = 'http://www.facebook.com/pages/Mypagenamegoeshere';
</script>

Does this code have to be in the header of the html page?

Thanks
#programming #button #facebook #needed
  • I would need more details of the surrounding code and more explanation where you are putting this code and what you expect it to do to be able to give you a better answer.

    However, from the code you're showing, the syntax is wrong, and you're not specifying it's a link-- I think it should be window.top.location.href = (you don't have .href, and I think you can just leave out "window") but most of all, you are not connecting it to any kind of an event, such as onClick.

    But it looks like you're trying to make it redirect to your FanPage, when in fact the Like Button is already designed to first take a person to the Facebook login page to either login or signup, and then they will be directed to your FanPge.

    But...if all you are trying to do is send them directly to your FanPage without logging in, why not just change the code in the button to a standard <a href> link? Forget about a "redirect"--just go direct!

    Hope that's some kind of help

    • [ 1 ] Thanks
    • [1] reply
    • Thanks for your help. Are there any good reference books around for customising Facebook fanpages?

      Kind regards
  • Maybe you wanna look into facebook developer api for customization
  • look for the code for like button for facebook in google, as I remember its in php form so all you need to do is like

    if(like=true)
    <script>trigger redirection</script>
    else
    none

    hope this gives u idea.
  • thats some nice info in this thread...thanks for sharing.
    • [1] reply
    • Thanks for everyone's help.

      Much appreciated

      Regards

Next Topics on Trending Feed