I have created URL something like: http://example.com/namespace/page#img-3
I want to share my URL same as given above. But, when I share this URL to the social media it is sharing only page URL: http://example.com/namespace/page
without #img-3
#img-3 is the element id which I want to share from the page and pass it into the anchor tag to add in the URL
<a href="#img-<?php echo $video->getId(); ?>">
<img src="https://img.youtube.com/vi/<?php echo $video->getVideoUrl() ?>/0.jpg"/>
</a>
I am using below FB share code:
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.11&appId=1336483029802737';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="<?php echo $baseURL_l.'video#img-'.$video->getId()?>" data-layout="button_count" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div>