Dynamic Facebook Like URLs with Javascript- displaying but not posting -
i have multiple blocks of content on page users can open , explore. within these blocks button relevant each block. each button widget has url dynamically generated when blocks of content opened, e.g.
$('.socialmedia').append("<div class='fb-like' data-href='"+likeurl+"' data-send='true' data-width='250' data-show-faces='false' data-colorscheme='dark'></div>");
the url address in format of http://url.com/like-shy76739jj.php - when accessed such urls redirect query-string url via .htaccess magic. however, irrelevant problem...
the issue is dynamic url generated through javascript not send through facebook. generates correctly in source code (inspecting button elements shows correct url in widget href attribute), , appears correctly in button pop-up window (straight after button clicked, when user has choice enter additional message), when check story on facebook url incorrect - comes as:
http://url.com/like-.php - dynamic id slotting in likeurl variable not translating page facebook story. have no idea why.
i using fb.xfbml.parse(document.getelementbyid('socialmedia'));
code already, not solving issue.
tl:dr dynamic urls used in facebook buttons display correctly within widget, not in generated facebook story.
thanks help!
each http://url.com/like-[...]
page should has opengraph tags - og:title, og:image etc. example:
<meta property="og:title" content="your section - website" /> <meta property="og:type" content="website" /> <meta property="og:url" content="url_of_page" /> <meta property="og:image" content="http://url.com/images/section1.jpg" /> <meta property="og:description" content="description"/>
you can test urls using opengraph debugger - https://developers.facebook.com/tools/debug
Comments
Post a Comment