支付宝为了所谓的安全,禁止直接跳转,方法是检测到有非支付宝referer就302到https://shenghuo.alipay.com/send/payment/fill.htm 。
我们可以用B站的HTTPS跳转法,但是如果懒得弄证书什么的,这里给出一个不是很漂亮的方法:
<html> <head> <title>正在跳转……</title> <meta http-equiv="Content-Language" content="zh-CN"> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"> </head> <body> <script> URL = "https://shenghuo.alipay.com/send/payment/fill.htm?optEmail={邮箱}&payAmount={钱数}&title={附言}" function lose_in_webkit(url) { location = "data:text/html,\<script>location='" + url + '&_=' + Math.random() + "'\</scr"+"ipt>"; return false; } function lose_in_ie(url) { window.open(url + '&_='+Math.random()); } function lose_in_ff(url) { location = 'data:text/html,\<html>\<meta http-equiv="refresh" content="0; url='+ url + '">\</html>'; } function post_and_lose(url) { location = 'data:text/html,\<html>\<meta http-equiv="refresh" content="0; url=data:text/html,\<form id=f method=post action=\''+url+'\'>\</form>\<script>document.getElementById(\'f\').submit()\</scri'+'pt>">\</html>'; } if(navigator.userAgent.indexOf("Chrome") != -1 ) { lose_in_webkit(URL); } else if(navigator.userAgent.indexOf("Opera") != -1 ) { lose_in_webkit(URL); } else if(navigator.userAgent.indexOf("Firefox") != -1 ) { lose_in_ff(URL); } else if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) //IF IE > 10 { lose_in_ie(URL); } else { lose_in_webkit(URL); } </script> </body> </html>
备份。
延伸阅读:
http://blog.kotowicz.net/2011/10/stripping-referrer-for-fun-and-profit.html