Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii
I have tried to share my current page dynamic link on facebook. But the issue is that when I am sharing my current page link on facebook the image is not sharing, only text is sharing.Please suggest me.

What I have tried:

<li>  <a class="fa fa-facebook icon facebook" href="https://www.facebook.com/sharer/sharer.php?u=&t=" title="Share on Facebook" target="_blank" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(document.URL) + '&t=' + encodeURIComponent(document.URL)); return false;"> </a></li>
Posted
Updated 4-Feb-20 2:07am

Getting your link on Facebook (or other platform) is one thing; getting what you want displayed (title, image, etc) is another thing.

Fortunately Facebook recognizes the Open Graph Protocol so you can use the OG Meta Tags to help FB know what you want displayed when someone shares your link

Different social platforms use different markup, naturally. The last link referenced will show you that Twitter has their own thing for this, similar but different.

References:
The Open Graph protocol[^]
Facebook Developers | PlugIns | Share Button[^]
The Essential Meta Tags for Social Media | CSS-Tricks[^]
 
Share this answer
 
It may be a functionality, not a bug, that images are not shared.
It could be a preventive measure to stop people trying to scam other users.
Scammers Use Facebook Sharer Page to Push Tech Support Scams[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900