本文介绍了无法在移动网站中使用facebook sharer.php自定义参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拥有一个jQuery移动网站.在那里,我使用带有自定义参数的facebook共享选项来添加标题,描述,带有链接的图像

I own a jQuery mobile website. There i using facebook share option with custom parameters to add title, description, image with link

像下面这样, https ://www.facebook.com/sharer/sharer.php?s = 100& p%5Burl%5D = http%3A%2F%2Fgoogle%2F& p%5Bimages%5D%5B0%5D = https://www .google.com/images/srpr/logo3w.png& p%5Btitle%5D = My%20own%20title& p%5Bsummary%5D = My%20own%20description

但是当我尝试相同的移动链接时,它将重定向到 http://m.facebook.com/sharer.php?s=100&p%5Burl%5D=http%3A%2F%2Fgoogle%2F&p%5Bimages%5D%5B0%5D=https%3A%2F %2Fwww.google.com%2Fimages%2Fsrpr%2Flogo3w.png& p%5Btitle%5D = My + own + title& p%5Bsummary%5D = My + own + description& _rdr

But when i try the same link to mobile, it will redirect to http://m.facebook.com/sharer.php?s=100&p%5Burl%5D=http%3A%2F%2Fgoogle%2F&p%5Bimages%5D%5B0%5D=https%3A%2F%2Fwww.google.com%2Fimages%2Fsrpr%2Flogo3w.png&p%5Btitle%5D=My+own+title&p%5Bsummary%5D=My+own+description&_rdr

这意味着它将在共享URL的开头添加m.facebook.因此它不能与自定义标题,desc,图片&链接.

which means, it will add m.facebook at the start of share url. so it wont work with custom title, desc, image & link.

是否要解决此问题?或如何强制移动网络不要使用m.facebook.com?

Anyway to fix this? or how to force mobile web to not to go with m.facebook.com ?

推荐答案

您可以通过在URL上添加?m2w参数来阻止Facebook访问移动网站.然后,sharer.php像往常一样工作.

You can prevent Facebook from going to the mobile site by adding a ?m2w parameter to the URL. Then, sharer.php works like usual.

例如

 https://www.facebook.com/sharer/sharer.php?m2w&s=100.... (etc)

虽然看起来有点不好,但希望找到更好的答案.

Looks kind of bad though, looking for a better answer.

不推荐使用Sharer.php,请参见下面的Felix回答.

Sharer.php has been deprecated, see Felix' answer below.

这篇关于无法在移动网站中使用facebook sharer.php自定义参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 17:18