微信浏览器是不支持打开App Store 页面的,不知道微信为什么这么做。比如你页面写 <a href=”http://itunes.apple/us/app/id903800747″>download</a> ,在微信浏览器点击链接是没有反应的,但是如果是其他的链接地址,比如百度那就没有问题
后来我发现如果你在微信官方后台编辑图文,把原文链接写为:http://mp.weixin.qq/mp/redirect?url=http%3A%2F%2Fitunes.apple%2Fus%2Fapp%2Fid903800747%23rd,那就可以打开了,发现微信页面的“查看原文”是一个function,如下
2 | var redirectUrl = sourceurl.indexOf('://') < 0 ? 'http://' + sourceurl : sourceurl; |
3 | //redirectUrl = http://itunes.apple/us/app/id903800747点击打开链接 |
4 | redirectUrl = 'http://' + location.host + '/mp/redirect?url=' + encodeURIComponent(sourceurl); |
5 | //此处是关键,redirectUrl = http://mp.weixin.qq/mp/redirect?url=http%3A%2F%2Fitunes.apple%2Fus%2Fapp%2Fid903800747%23rd |
7 | url: '/mp/advertisement_report' + location.search + '&report_type=3&action_type=0&url=' + encodeURIComponent(sourceurl) + '&uin=' + uin + '&key=' + key + '&__biz=' + biz + '&r=' + Math.random(), |
11 | return tid ? opt.success = function (res) { |
13 | res = eval('(' + res + ')'); |
18 | res && res.ret == 0 ? location.href = redirectUrl : viewSource(); |
20 | : (opt.timeout = 2000, optplete = function () { |
21 | location.href = redirectUrl; |
真正的url是:http://mp.weixin.qq/mp/redirect?url=http%3A%2F%2Fitunes.apple%2Fus%2Fapp%2Fid903800747%23rd
看来微信允许打开mp.weixin.qq这个host下的网页,然后用js再打开真正的页面。
现在简单了,将页面的代码写为:<a href=”http://mp.weixin.qq/mp/redirect?url=http%3A%2F%2Fitunes.apple%2Fus%2Fapp%2Fid903800747%23rd”>download</a>,在微信浏览器内可以打开app store的地址了。
转自:http://www.ildsea/1781.html
微信浏览器是不支持打开App Store 页面的,不知道微信为什么这么做。比如你页面写 <a href=”http://itunes.apple/us/app/id903800747″>download</a> ,在微信浏览器点击链接是没有反应的,但是如果是其他的链接地址,比如百度那就没有问题
后来我发现如果你在微信官方后台编辑图文,把原文链接写为:http://mp.weixin.qq/mp/redirect?url=http%3A%2F%2Fitunes.apple%2Fus%2Fapp%2Fid903800747%23rd,那就可以打开了,发现微信页面的“查看原文”是一个function,如下
2 | var redirectUrl = sourceurl.indexOf('://') < 0 ? 'http://' + sourceurl : sourceurl; |
3 | //redirectUrl = http://itunes.apple/us/app/id903800747点击打开链接 |
4 | redirectUrl = 'http://' + location.host + '/mp/redirect?url=' + encodeURIComponent(sourceurl); |
5 | //此处是关键,redirectUrl = http://mp.weixin.qq/mp/redirect?url=http%3A%2F%2Fitunes.apple%2Fus%2Fapp%2Fid903800747%23rd |
7 | url: '/mp/advertisement_report' + location.search + '&report_type=3&action_type=0&url=' + encodeURIComponent(sourceurl) + '&uin=' + uin + '&key=' + key + '&__biz=' + biz + '&r=' + Math.random(), |
11 | return tid ? opt.success = function (res) { |
13 | res = eval('(' + res + ')'); |
18 | res && res.ret == 0 ? location.href = redirectUrl : viewSource(); |
20 | : (opt.timeout = 2000, optplete = function () { |
21 | location.href = redirectUrl; |
真正的url是:http://mp.weixin.qq/mp/redirect?url=http%3A%2F%2Fitunes.apple%2Fus%2Fapp%2Fid903800747%23rd
看来微信允许打开mp.weixin.qq这个host下的网页,然后用js再打开真正的页面。
现在简单了,将页面的代码写为:<a href=”http://mp.weixin.qq/mp/redirect?url=http%3A%2F%2Fitunes.apple%2Fus%2Fapp%2Fid903800747%23rd”>download</a>,在微信浏览器内可以打开app store的地址了。
转自:http://www.ildsea/1781.html