使用 HTML 在 Android 消息应用程序上禁用链接预览 [英] Disable Link Preview on Android Message App using HTML

查看:34
本文介绍了使用 HTML 在 Android 消息应用程序上禁用链接预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个网站,例如,说

解决方案

好吧,这不是您问题的确切答案,但您可以即兴编写代码来解决开放图问题.

根据屏幕截图,该应用程序似乎完全支持 opengraph.我确信打开的图形没有正确实现,这就是为什么你没有正确看到图像或文本.您可能想使用以下网址中的 facebook 调试器工具测试该网址,https://developers.facebook.com/tools/debug/

您可以交叉检查您的 og 实现,如下所示.您可以根据需要使值动态化.请参见下面的示例(使用 Asp.net MVC,当然您可以根据语言使用自己的代码).检查您缺少什么.

<meta property="og:url" content="@ViewBag.OGURl"/><meta property="og:image" content="@ViewBag.OgImage"/><meta property="og:type" content="website"/><meta property="og:description" content="@ViewBag.OgHeadline"/>

完成后,再次在 facebook 调试器工具上重新测试 url.如果它在调试器上工作,我敢打赌它会在 android 消息应用程序上 100% 工作.

We have a site, for example, say https://www.example.com and then user sends this URL through Android Official Message App to some contact, then there is a preview generated using the HTML rendered, which we don't want. Like totally disabling this feature from our side.

NOTE: Android Message app does not follow the Open Graph Protocol, as I have already tried emptying the meta tags related to this protocol. That is why currently according to my research, there is no such code to disable this feature programmatically.

We want to do it using HTML so that we control it from the development side as we don't know how users are sharing our links. We can't suggest workarounds to users.

Is there anyone who has faced this and tried some tricks to solve in HTML, JavaScript or jQuery. I am also open to a server-side implementation if that is the case.

解决方案

Well, it is not the exact answer for your question, but you can improvise your code to fix the open graph issue.

As per the screenshot, it seems the app is fully supporting the opengraph. I am sure open graph is not implemented correctly, that is why you don't see the image or text correctly. You might like to test the url with the facebook debugger tool from the below url, https://developers.facebook.com/tools/debug/

You can crosscheck your og implementations as below. You can make the values dynamic as per your need. See the below example (with Asp.net MVC, of course you can use your own code depending on the language). Check what you are missing.

<meta property="og:title" content="@ViewBag.OgTitle" />
<meta property="og:url" content="@ViewBag.OGUrl" />
<meta property="og:image" content="@ViewBag.OgImage" />
<meta property="og:type" content="website" />
<meta property="og:description" content="@ViewBag.OgHeadline" />

After completion retest the url on the facebook debugger tool again. If it works on the debugger, I bet it would work 100% on android messaging app.

这篇关于使用 HTML 在 Android 消息应用程序上禁用链接预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆