Html 如何从网页链接到微信?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35425553/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 18:57:27  来源:igfitidea点击:

How do I link to wechat from a webpage?

htmlwechaturi-scheme

提问by Rich

Whatsappallows you to link to a new message via

Whatsapp允许您通过以下方式链接到新消息

<a href="whatsapp://send?text=The text to share!" data-action="share/whatsapp/share" class="Share-link m-whatsapp">

How do I do the same thing with WeChat?

我如何做同样的事情WeChat

回答by garbetjie

WeChat does have a URI scheme that can be used from a browser. The scheme prefix is weixin://.

微信确实有一个可以从浏览器使用的 URI 方案。方案前缀是weixin://.

There are a few URIs that can be used with this:

有几个 URI 可以与此一起使用:

weixin://dl/stickers
weixin://dl/settings
weixin://dl/posts
weixin://dl/moments

However, in answer to your question specifically, there is one where you can chat to a contact specifically:

但是,为了专门回答您的问题,您可以在其中专门与联系人聊天:

weixin://dl/chat?{toID}

weixin://dl/chat?{toID}

You will need to replace {toID}with whatever the destination user's WeChat ID is.

您需要替换{toID}为目标用户的微信ID。

For reference's sake, these are the URLs that I've found this information from previously:

仅供参考,这些是我之前找到的这些信息的 URL:

回答by Pang Ho Ming

Weixin released an update 6.3.25 on 2016-09-05, which blocks almost all URL schemes request from non-weixin's application. Only requests from weixin's applications and some "white-listed" applications are allowed.

微信于2016-09-05 发布了6.3.25 更新,几乎屏蔽了非微信应用的所有URL Schemes 请求。仅允许来自微信应用程序和一些“白名单”应用程序的请求。

微信在 2016 年 9 月 5 日的 6.3.25 更新中,已经屏蔽了绝大部分外部发起的 URL Scheme 请求,只允许在微信内部或少量白名单应用中进行调用。鉴此,以下所展示的内容目前可能已经失效,本文仅供存档参考。

微信在 2016 年 9 月 5 日 6.3.25 中,已经屏蔽了外部发起的 URL Scheme 计划,只允许在微信内部或少量白名单应用中进行调用。鉴此,所展示的内容以下现在可能已经无法,这翻译成文档参考。

Translated from a mainland china's developer blog:

翻译自china大陆的开发者博客:

Source: https://spacekid.me/weixin-url-schemes/

来源:https: //spacekid.me/weixin-url-schemes/

回答by NJ.Lin

I'm not sure if what you wants to do is to hava a button on your view or web page, where on click it opens wechat and allows users to share the content to other people?

If it is an mobile application, you may want to have a look at wechat's offical api document.
You would first need to do some applications to wechat, then they may give you permission to use this function by providing you with an appId, you utilize this appId and implement interfaces they provide to realize sharing functions.

我不确定您想要做的是在您的视图或网页上添加一个按钮,点击它会打开微信并允许用户将内容分享给其他人吗?

如果是手机应用,你可能想看看微信的官方api文档
您首先需要对微信做一些应用,然后他们可能会通过向您提供一个appId来授予您使用该功能的权限,您利用这个appId并实现他们提供的接口来实现共享功能。

If you have a wechat offical acount, or you wish to show your web application pages within the browser inside the wechat app (this is my understanding), then you would want to take a look here. You would first have to register an offical account, and bind your application domain in the settings page within the account.

如果你有微信公众号,或者你想在微信应用内的浏览器中展示你的web应用页面(这是我的理解),那么你可以看看这里。您首先必须注册一个官方帐户,并在帐户内的设置页面中绑定您的应用程序域。

If you have a PC website and wish for users to share certain pages to wechat. what you can do is generate a QR code for that link, thus when users scan the code with wechat's scan function, the link would be opened within the browser inside wechat, and allowing users to use all wechat functions such as sharing.

如果您有一个PC网站,并希望用户将某些页面分享到微信。你可以做的是为那个链接生成一个二维码,这样当用户用微信的扫描功能扫描二维码时,这个链接就会在微信内部的浏览器中打开,并允许用户使用分享等所有微信功能。

回答by A Huang

When logging into wechat on a PC, you normally load the wechat webpage where there is a QR code. This must be scanned via the wechat client on your mobile phone. The client must be for the user attempting to contact you, it is their PC link to wechat. The user will be presented with their chat window (with their contacts listed). This is a security feature of wechat to ensure registered users only have access to the servers and to slow down trolling. The users mobile phone is the link to the system. When I go to the wechat webpage, I get a qr code and once I have scanned it using my phone app, I get my chat windows with only my contacts. You may be able to add your contact to the list but it still requires the user to have previously registered their mobile phone to the system.

在PC上登录微信时,您通常会加载有二维码的微信网页。这必须通过手机上的微信客户端扫描。客户端必须是试图与您联系的用户,是他们的 PC 微信链接。用户将看到他们的聊天窗口(列出他们的联系人)。这是微信的一项安全功能,以确保注册用户只能访问服务器并减慢拖钓速度。用户手机是系统的链接。当我进入微信网页时,我会得到一个二维码,一旦我使用我的手机应用程序扫描它,我的聊天窗口就会只显示我的联系人。您也许可以将您的联系人添加到列表中,但它仍然需要用户事先将他们的手机注册到系统中。