Like count for almost same URL (HTTP, HTTPS)

2019-02-20 17:19发布

问题:

I set like button on every page of my app. But facebook has two modes o viewing pages: unsecured (HTTP) and secured (HTTSP), so how should I do code href in fb:like to show that the same page on http and https should be count by facebook like as rely SAME page? As far as understand facebook like use URL path as uniq ID, so in fb:like tag I write now http://path or https://path depends on protocol that user use coming on my page, so formally this is two different page and facebook count would different for every page I suppose. How can I make count on http path and https path summiraze and show on both page the same like count? Or may be Facebook alredy solve this problem and I should be worried by this?

And similar question my app is avalable by direct url (mysite/path) so I want likes from such url also count as likes on the same pages but get from path apps.facebook.com/myapp/path. how could I do this? Just now I write in href of like tag path apps.facebook.com/myapp/path even if it accessed by direct URL. Is it corret decision to have solid count of likes get from diffrent entries to app?

回答1:

Just put the http url of the page regardless of the protocol the user is using. There's no reason to use https in the fb:like button since it's not being loaded anyway.

Another thing is that in the open graph meta tags, under the url param (og:url) put the http version always.

There's no problem to put the url of the fb canvas page in like button you have in the "direct url", though I think that I would do it the other way around, in the canvas page inside fb I would use the direct url in the like button.