1024programmer JavaScript This link will evoke mobile phone QQ, if it cannot jump normally, please upgrade QQ first

This link will evoke mobile phone QQ, if it cannot jump normally, please upgrade QQ first

,

Background introduction

It is a lot of companies or enterprises to invoke QQ from the browser to chat A customer service method that will be used. However, in many cases, some mobile browsers do not support direct jumping to QQ, or do not support jumping to QQ pages from the web pages embedded in the app.

Text

For the official website of QQ promotion and QQ promotion, you only need to scan and log in the QQ number that needs to be evoked, and you can generate a piece of code As follows:

Click here to send me a message

The number “123456789” here is the QQ number that needs to be awakened.

Using this method, you can invoke the QQ client in most browsers and locate the chat page, but this method will fail in the following situations:

1. The Safari browser that comes with the Apple mobile phone will prompt whether to open the link in the AppStore. If you choose yes, it will directly jump to the App Store, and then you can jump to QQ, but the parameters will be lost after two jumps, resulting in failure Open the object that needs to be chatted;

2. In the Google browser on the mobile phone, the situation similar to that in 1 will also exist;

3. The webpage is embedded in the self-developed App , A situation similar to 1 will also appear when it is necessary to arouse QQ;

Because the Safari browser is highly used on the Apple mobile phone end, it has to find another way for it to meet business needs.

Through understanding, I found that the connection between apps can be solved through a technology called deep linking.

One solution in deep linking is to define a new URL Scheme, which can pass parameters to another APP through a specific URI method, thus changing the situation of independent and non-communicating between Apps.

Separately talk about evoking QQ, or to solve the problem that Safari browser cannot arouse QQ, you can use the following URI:

mqqwpa:  //im/chat?  chat_type=wpa&uin=123456789&version=1&src_type=web&web_src=oicqzone.com

The number “123456789” is also the QQ that needs to be aroused.

  123456789

Through multiple tests, I have sorted out the following different situations in which mobile browsers evoke QQ (where no means that the test is unsuccessful, and ok means that the test is successful):

It needs to be mentioned here that using the URL Scheme scheme for various browsers of the computer to arouse QQ will not have any effect, because the URL Scheme is specially designed to solve the situation of isolation between APPs. What came out is not suitable for computer applications, but the solution given by QQ promotion can be used on the computer side.

I know how to solve the problem of app jumping to QQ, but many times we hope to have a general solution to solve the above situations, so that most browsers (including computer browsers) only need One set of code can solve the problem.

I personally distinguish between mobile browsers and computer browsers by judging the browser’s userAgent, and then provide them with different solutions:

HTML code

111111111111

Javascript code

window. Onload = function () {
     var as = document.getElementsByTagName('a');
     var kefu101 = "http://wpa.qq.com/msgrd?v=3&uin=381232999&site=oicqzone.com&menu=yes";
     var kefu102 = "mqqwpa://im/chat?chat_type=wpa&uin=381232999&version=1&src_type=web&web_src=oicqzone.com";
     for (var i = 0, len = a.length; i <len; i++) {
         if (as[i].hasAttribute('data-qq')) {
             as[i].Onclick= (function (i) {
                 return function (e) {
                 var kefu = e.target ? e.target.getAttribute('data-qq') : e.srcElement.getAttribute('data-qq'); if (/(iPhone|iPad  |iPod|iOS)/i.test(navigator.userAgent) || /(Android)/i.test(navigator.userAgent)) { window.open(kefu102);
                     }
                     else {window.open(kefu101);
                     }
                 }
             })(i);
         }
     }
 };

In this set of schemes, the mobile terminal uses the URL Scheme, and the computer terminal uses the QQ promotion scheme.

For more related tutorials, please visit 1024programmer.com js introductory tutorial column.

The above is that the link will evoke mobile phone QQ. If you cannot jump normally, please update the detailed content of QQ first. For more information, please pay attention to other related articles on 1024programmer.com!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/this-link-will-evoke-mobile-phone-qq-if-it-cannot-jump-normally-please-upgrade-qq-first/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索