Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

share image content and url on whatsapp from web site without og tag

Tags:

php

whatsapi

WhatsApp share a link, content and image this can be done by using og tags i.e. open graph tags

<meta property="og:title" content="title" />
<meta property="og:description" content="Description for image" />
<meta property="og:url" content="https://myurl.com" />
<meta property="og:image" content="https://myurl.com/imagepth" />

But this has limitation, we can share only one image

I want something as like of facebook sharer link which can share image content url

https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmyurl.com%2F

I am having multiple links with images content on one page I want set option for each block to be share on WhatsApp as like of facebook sharer

Using og tag we can share single image content from one page

enter image description here

but I need separate link for each block to be share as shown share button on reference image above

like image 648
Sachin Sudhakar Sonawane Avatar asked Jun 12 '17 14:06

Sachin Sudhakar Sonawane


1 Answers

One possible solution is to have separate "share" pages for each shareable entity. Each page can contain the og tags (especially an image) for the single box/button which links there.

Since the shared URL may then look like example.org/shared.php?id=1 it is also the URL the user will access if they click on the shared block on facebook/whatsapp. You have two possibilities to deal with this situation:

  1. Provide a "detail" page for every of your shareable entities, but I guess there are no detail pages in your current setup and based on the size of your boxes you may not want them.
  2. Redirect to your "list" page, if the useragent is nothing related to whatsapp/facebook. This case whatsapp/facebook "sees" the HTML containing the og tags and when real users enter the page they are redirected to the list page.
like image 115
Ulrich Thomas Gabor Avatar answered Nov 08 '22 06:11

Ulrich Thomas Gabor