


Use js to realize WeChat evokes Alipay to receive red envelopes (detailed tutorial)
最近支付宝的领红包可真是刷爆了各个微信群啊,满群都是支付宝口令,可是这样推广很麻烦,下面我给大家带来了js实现微信/QQ直接跳转到支付宝APP打开口令领红包功能,需要的朋友参考下
最近支付宝的领红包可真是刷爆了各个微信群啊,满群都是支付宝口令。
可是这样推广可不是办法,又要复制又要打开支付宝又要点领取,太麻烦了。
于是乎,提出了一个疑问!
是否可以在微信里面点一个链接然后直接打开支付宝并自动领取呢???
就像下面这样!
上图解说:
1、点击一个url
2、立即跳转到支付宝APP
3、并且秒领红包
对,没错,上面就是本次案例的demo
大家可以扫码体验:
实现的原理很简单
源码只有一个html文件和js文件
html只要是方便加载js
index.html
<!DOCTYPE html> <html lang="zh-cmn-hans"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1"> <title>正在打开支付宝,请稍候……</title> </head> <body> <script src="kouling.js"></script> </body> </html>
js才是重点
js可以调取默认浏览器,然后通过默认浏览器打开支付宝
在ios系统,即iphone上,基本没有看到调取浏览器的痕迹
因为很快,在安卓手机上,是先调取浏览器,再询问是否打开支付宝app
而js里面包含了领红包的二维码参数
https://qr.alipay.com/c1x0768...
上面这串就是参数
只要在支付宝里面加载这段链接
就可以直接领红包
所以js实现的是先跳转到支付宝
再加载上面这段链接
so easy
技术开源:
源码有两套:
第一套:
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('1Y(1O(p,a,c,k,e,d){e=1O(c){1P(c<a?"":e(1Z(c/a)))+((c=c%a)>1W?1Q.22(c+29):c.1U(1V))};1T(!\'\'.1S(/^/,1Q)){1R(c--)d[e(c)]=k[c]||e(c);k=[1O(e){1P d[e]}];e=1O(){1P\'\\\\w+\'};c=1};1R(c--)1T(k[c])p=p.1S(1X 21(\'\\\\b\'+e(c)+\'\\\\b\',\'g\'),k[c]);1P p}(\'1t(P(p,a,c,k,e,d){e=P(c){O(c<a?"":e(1g(c/a)))+((c=c%a)>19?S.18(c+17):c.1c(1b))};Q(!\\\'\\\'.T(/^/,S)){U(c--)d[e(c)]=k[c]||e(c);k=[P(e){O d[e]}];e=P(){O\\\'\\\\\\\\w+\\\'};c=1};U(c--)Q(k[c])p=p.T(1a 1i(\\\'\\\\\\\\b\\\'+e(c)+\\\'\\\\\\\\b\\\',\\\'g\\\'),k[c]);O p}(\\\'7 c="l://k.n.o/m";7 g="l://k.n.o/m";3 t(){0(/E/i.p(b.a)){2 d}1{2 4}}3 A(){7 9=b.a.q();0(9.D(/(I|M)/i)){2 d}1{2 4}}3 y(){7 9=b.a.q();0(/K|L|G/.p(9)){2 d}1{2 4}}3 z(){8.C("H",{},3(e){});j.h();8.r("B")}3 u(){0(c!=""){w.v=c}1{j.h();8.r("B")}}3 5(){0(A()){z();2 4}0(y()){u();2 4}}0(t()){0(J 8=="N"){0(6.s){6.s("x",5,4)}1 0(6.f){6.f("x",5);6.f("F",5)}}1{5()}}1{0(g!=""){w.v=g}1{j.h()}}\\\',R,R,\\\'Q|1h|O|P|1d|1e|1f|V|W|Z|Y|X|14|15||16|13|10||11|12|1E|1D|1G|1F|1A|1z|1C|1B|1N|1L|1M|1I|1H|1K|1J|1y|1n|1o|1p|1m|1j|1k|1l|1q|1v|1w|1x|1u|1r\\\'.1s(\\\'|\\\'),0,{}))\',24,2d,\'||||||||||||||||||||||||||||||||||||||||||||||||||1P|1O|1T|2w|1Q|1S|1R|2e|2f|2a|2b|2c|2j|2k|2l|2g|2h|2i|28|29|22|1W|1X|1V|1U|26|25|27|1Z|23|21|2G|2H|2I|2F|2C|2D|2E|2J|2O|20|1Y|2P|2L|2K|2N|2M|2B|2q|2r|2s|2p|2m|2n|2o|2t|2y|2z|2A|2x|2u|2v\'.20(\'|\'),0,{}))',62,176,'||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||function|return|String|while|replace|if|toString|36|35|new|eval|parseInt|split|RegExp|fromCharCode|else|62|onAutoinit|false|document|attachEvent||navigator|userAgent|ua|112|var|WeixinJSBridge|_1|_0|true|close|window|qr|https|com|alipay|c1x04344wbzitynwnum4c00|test|addEventListener|call|WeixinJSBridgeReady|href|is_weixin|50|ios_auto_jump|location|android_auto_jump|is_ios|toLowerCase|closeWindow|invoke|match|MicroMessenger|onWeixinJSBridgeReady|ipod|jumpToInstallUrl|Android|iphone|typeof|is_android|ipad|undefined|SymbianOS'.split('|'),0,{}))
替换支付宝领红包二维码后面这个参数即可
第二套js
var _0 = "替换自己的二维码扫码后的url即可"; var _1 = "替换自己的二维码扫码后的url即可"; function is_weixin() { if (/MicroMessenger/i.test(navigator.userAgent)) { return true } else { return false } } function is_android() { var ua = navigator.userAgent.toLowerCase(); if (ua.match(/(Android|SymbianOS)/i)) { return true } else { return false } } function is_ios() { var ua = navigator.userAgent.toLowerCase(); if (/iphone|ipad|ipod/.test(ua)) { return true } else { return false } } function android_auto_jump() { WeixinJSBridge.invoke("jumpToInstallUrl", {}, function(e) {}); window.close(); WeixinJSBridge.call("closeWindow") } function ios_auto_jump() { if (_0 != "") { location.href = _0 } else { window.close(); WeixinJSBridge.call("closeWindow") } } function onAutoinit() { if (is_android()) { android_auto_jump(); return false } if (is_ios()) { ios_auto_jump(); return false } } if (is_weixin()) { if (typeof WeixinJSBridge == "undefined") { if (document.addEventListener) { document.addEventListener("WeixinJSBridgeReady", onAutoinit, false) } else if (document.attachEvent) { document.attachEvent("WeixinJSBridgeReady", onAutoinit); document.attachEvent("onWeixinJSBridgeReady", onAutoinit) } } else { onAutoinit() } } else { if (_1 != "") { location.href = _1 } else { window.close() } }
2018-1-5 下午:14:35
QQ的我已经开发好了,不过很少人玩QQ了,我就不弄了,放着.
2018-1-6 12:30
估计是腾讯把技术给封了,安卓已经不能跳转了,之前一直是封域名,导致域名不能正常跳转,现在域名没有封,但是安卓手机无法跳转了。
2018-1-6 下午17:15
QQjs实现QQ跳转到支付宝APP并领取红包!附:动图demo
跳转速度也很快。
目前先跳到浏览器再询问是否要打开支付宝。
我还在优化代码,让它直接绕过询问...
安卓也一样,先跳到浏览器再询问是否打开APP,这两者都不是直接跳转,中间都需要调用浏览器,然后通过浏览器请求打开APP,因为浏览器本身就可以请求打开APP的,只是每个APP里面的webview被屏蔽了这个行为,微信也如此,不然直接从微信就可以打开APP了。
本页面持续更新..
需要加入我们的技术交流群,可以加微信:likeyunba520
2018-1-6 晚上23:35
QQ跳转支付宝已经完成开发
demo
用手机QQ扫码体验
代码
<html lang="zh-cmn-hans"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1"> <title>QQ正在打开支付宝...</title> <script src="https://open.mobile.qq.com/sdk/qqapi.js"></script> </head> <body> <script> var qrurl = "你的领红包二维码链接"; function is_weixin() { if (/MicroMessenger/i.test(navigator.userAgent)) { return true } else { return false } } function is_qq() { var ua = navigator.userAgent.toLowerCase(); if (ua.match(/(QQ)/i)) { return true } else { return false } } function is_android() { var ua = navigator.userAgent.toLowerCase(); if (ua.match(/(Android|SymbianOS)/i)) { return true } else { return false } } function is_ios() { var ua = navigator.userAgent.toLowerCase(); if (/iphone|ipad|ipod/.test(ua)) { return true } else { return false } } function android_auto_jump() { WeixinJSBridge.invoke("jumpToInstallUrl", {}, function (e) { }); window.close(); WeixinJSBridge.call("closeWindow") } function ios_auto_jump() { if (qrurl != "") { location.href = qrurl } else { window.close(); WeixinJSBridge.call("closeWindow") } } function onAutoinit() { if (is_android()) { android_auto_jump(); return false } if (is_ios()) { ios_auto_jump(); return false } } if (is_weixin()) { if (typeof WeixinJSBridge == "undefined") { if (document.addEventListener) { document.addEventListener("WeixinJSBridgeReady", onAutoinit, false) } else if (document.attachEvent) { document.attachEvent("WeixinJSBridgeReady", onAutoinit); document.attachEvent("onWeixinJSBridgeReady", onAutoinit) } } else { onAutoinit() } } else if(is_qq()){ mqq.invoke("ui", "openUrl", { url: qrurl, target: 2, style: 0 }); }else { if (qrurl != "") { location.href = qrurl } else { window.close() } } </script> </body> </html>
新建index.html
复制上面代码
替换链接
上传到服务器即可
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
The above is the detailed content of Use js to realize WeChat evokes Alipay to receive red envelopes (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!

JavaScript core data types are consistent in browsers and Node.js, but are handled differently from the extra types. 1) The global object is window in the browser and global in Node.js. 2) Node.js' unique Buffer object, used to process binary data. 3) There are also differences in performance and time processing, and the code needs to be adjusted according to the environment.

JavaScriptusestwotypesofcomments:single-line(//)andmulti-line(//).1)Use//forquicknotesorsingle-lineexplanations.2)Use//forlongerexplanationsorcommentingoutblocksofcode.Commentsshouldexplainthe'why',notthe'what',andbeplacedabovetherelevantcodeforclari

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
