Help needed please: The Like button on Facebook

6 replies
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
#button #facebook #needed
  • Profile picture of the author sparkmarketing
    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

    {{ DiscussionBoard.errors[3945720].message }}
    • Profile picture of the author bizwebstart
      Thanks for your help. Are there any good reference books around for customising Facebook fanpages?

      Kind regards
      Signature
      Need a Video creating? Affordable Web Videos
      {{ DiscussionBoard.errors[3947583].message }}
  • Profile picture of the author baoky
    Maybe you wanna look into facebook developer api for customization
    {{ DiscussionBoard.errors[3948402].message }}
  • Profile picture of the author kinselatos
    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.
    {{ DiscussionBoard.errors[3948928].message }}
  • Profile picture of the author altan
    thats some nice info in this thread...thanks for sharing.
    {{ DiscussionBoard.errors[3949252].message }}

Trending Topics