Facebook like iframe ignores my specified href

Posted by Zhami on Stack Overflow See other posts from Stack Overflow or by Zhami
Published on 2010-05-29T16:15:24Z Indexed on 2010/05/29 16:22 UTC
Read the original article Hit count: 236

Filed under:

I have Javascript that imputes (computes and injects) HTML into my DOM for the Facebook "Like" function. I need to specify a "canonical" URL because the actual URL doesn't reflect all the DOM manipulations that have been made (driven by user activity on the Web "page"). Alas, Facebook's code doesn't use the url I supply but the window.location value (which has #hash aspects that influence the page's presentation, but that aren't accessible to the server). Anyway... why is FB's code ignoring the url I give to it?

I generate the HTML thus:

var html = '<iframe src="http://www.facebook.com/plugins/like.php?href=' + encodeURI(url) + '&layout=standard&show_faces=false&width=100&action=recommend&font=arial&colorscheme=light" style="border:none; overflow:hidden; width:270px; height:26px;" allowTransparency="true" frameborder="0" scrolling="no"></iframe>'

© Stack Overflow or respective owner

Related posts about facebook