当前访客身份:游客 [ 登录 | 加入开源中国 ]

代码分享

当前位置:
代码分享 » HTML  » 手机App开发
分享到: 
收藏 +0
2
通过iframe的方式试图打开本地APP,如果能正常打开,会直接切换到本地APP,并自动阻止a标签的默认行为
否则打开a标签的href链接
部分代码来自阿里巴巴的支付宝 m.alipay.com/appIndex.htm
标签: <无>

代码片段(4) [全屏查看所有代码]

1. [代码][XML]代码     跳至 [1] [2] [3] [4] [全屏预览]

<!--在AndroidManifest.xml中,定义Activity的Intent-filter-->
            <intent-filter>
	            <action android:name="android.intent.action.VIEW" />  
	            <category android:name="android.intent.category.DEFAULT" />  
	            <category android:name="android.intent.category.BROWSABLE" />  
                    <data android:scheme="alipays" /> 
            </intent-filter>
<!--VIEW,DEFAULT和BROWSABLE一个都不能少-->
<!--最后的scheme是注册sf://这样的协议,当网页链接到这种协议的时候,就调用这个程序。-->

2. [代码][Java]代码     跳至 [1] [2] [3] [4] [全屏预览]

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	       final Intent intent = getIntent();   
	        final Uri uri = intent.getData();
	         setTitle("自定义协议");
	        textView.setText(uri.toString());
	}

3. [代码][其他]代码     跳至 [1] [2] [3] [4] [全屏预览]

服务器响应部分
HTTP/1.1 200 OK
Date: Sat, 26 Apr 2014 16:49:19 GMT
Server: Apache
Set-Cookie: JSESSIONID=B3110F555F065616E9DE84526BC81D57; Path=/
Strict-Transport-Security: max-age=31536000
Set-Cookie: awid=mBDlK5rXYhf8K2OqfxFQa4YYUWehFkwap; Domain=.alipay.com; Path=/
Content-Language: zh-CN
Vary: Accept-Encoding,User-Agent
Cache-Control: max-age=0,no-cache
Expires: Thu, 05 Jan 1995 22:00:00 GMT
Pragma: no-cache
Keep-Alive: timeout=360, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html;charset=UTF-8

4. [代码]网页加载时自动切换到本地app     跳至 [1] [2] [3] [4] [全屏预览]

<html>
<head>
    <meta charset="UTF-8">
    <title>支付宝网站</title>
	<!-- CMS 无线监控埋点 开始 -->
	<!-- CMS:无线/无线wap全站通用/mtracker开始:wap/wap_common/mtracker.vm --><script>
window._to = { start: new Date() };
</script>
<script>
	!function(a) {
		function b(a) {
			return Object.prototype.toString.call(a)
		}
		function c(a) {
			return "[object Object]" === b(a)
		}
		function d(a) {
			return "[object Function]" === b(a)
		}
		function e(a, b) {
			for (var c = 0,
			d = a.length; d > c && b.call(a, a[c], c) !== !1; c++);
		}
		function f(a) {
			if (!p.test(a)) return null;
			var b, c, d, e, f;
			if ( - 1 !== a.indexOf("trident/") && (b = /\btrident\/([0-9.]+)/.exec(a), b && b.length >= 2)) {
				d = b[1];
				var g = b[1].split(".");
				g[0] = parseInt(g[0], 10) + 4,
				f = g.join(".")
			}
			b = p.exec(a),
			e = b[1];
			var h = b[1].split(".");
			return "undefined" == typeof f && (f = e),
			h[0] = parseInt(h[0], 10) - 4,
			c = h.join("."),
			"undefined" == typeof d && (d = c),
			{
				browserVersion: f,
				browserMode: e,
				engineVersion: d,
				engineMode: c,
				compatible: d !== c
			}
		}
		function g(b) {
			if (o) try {
				var c = o.twGetRunPath.toLowerCase(),
				d = o.twGetSecurityID(a),
				e = o.twGetVersion(d);
				if (c && -1 === c.indexOf(b)) return ! 1;
				if (e) return {
					version: e
				}
			} catch(f) {}
		}
		function h(a, e, f) {
			var g = d(e) ? e.call(null, f) : e;
			if (!g) return null;
			var h = {
				name: a,
				version: k,
				codename: ""
			},
			i = b(g);
			if (g === !0) return h;
			if ("[object String]" === i) {
				if ( - 1 !== f.indexOf(g)) return h
			} else {
				if (c(g)) return g.hasOwnProperty("version") && (h.version = g.version),
				h;
				if (g.exec) {
					var j = g.exec(f);
					if (j) return h.version = j.length >= 2 && j[1] ? j[1].replace(/_/g, ".") : k,
					h
				}
			}
		}
		function i(a, b, c, d) {
			var f = u;
			e(b,
			function(b) {
				var c = h(b[0], b[1], a);
				return c ? (f = c, !1) : void 0
			}),
			c.call(d, f.name, f.version)
		}
		var j = {},
		k = "-1",
		l = navigator.userAgent || "",
		m = navigator.appVersion || "",
		n = navigator.vendor || "",
		o = a.external,
		p = /\b(?:msie |ie |trident\/[0-9].*rv[ :])([0-9.]+)/,
		q = [["nokia",
		function(a) {
			return - 1 !== a.indexOf("nokia ") ? /\bnokia ([0-9]+)?/: -1 !== a.indexOf("noain") ? /\bnoain ([a-z0-9]+)/: /\bnokia([a-z0-9]+)?/
		}], ["samsung",
		function(a) {
			return - 1 !== a.indexOf("samsung") ? /\bsamsung(?:\-gt)?[ \-]([a-z0-9\-]+)/: /\b(?:gt|sch)[ \-]([a-z0-9\-]+)/
		}], ["wp",
		function(a) {
			return - 1 !== a.indexOf("windows phone ") || -1 !== a.indexOf("xblwp") || -1 !== a.indexOf("zunewp") || -1 !== a.indexOf("windows ce")
		}], ["pc", "windows"], ["ipad", "ipad"], ["ipod", "ipod"], ["iphone", /\biphone\b|\biph(\d)/], ["mac", "macintosh"], ["mi", /\bmi[ \-]?([a-z0-9 ]+(?= build))/], ["aliyun", /\baliyunos\b(?:[\-](\d+))?/], ["meizu", /\b(?:meizu\/|m)([0-9]+)\b/], ["nexus", /\bnexus ([0-9s.]+)/], ["huawei",
		function(a) {
			return - 1 !== a.indexOf("huawei-huawei") ? /\bhuawei\-huawei\-([a-z0-9\-]+)/: /\bhuawei[ _\-]?([a-z0-9]+)/
		}], ["lenovo",
		function(a) {
			return - 1 !== a.indexOf("lenovo-lenovo") ? /\blenovo\-lenovo[ \-]([a-z0-9]+)/: /\blenovo[ \-]?([a-z0-9]+)/
		}], ["zte",
		function(a) {
			return /\bzte\-[tu]/.test(a) ? /\bzte-[tu][ _\-]?([a-su-z0-9\+]+)/: /\bzte[ _\-]?([a-su-z0-9\+]+)/
		}], ["vivo", /\bvivo ([a-z0-9]+)/], ["htc",
		function(a) {
			return /\bhtc[a-z0-9 _\-]+(?= build\b)/.test(a) ? /\bhtc[ _\-]?([a-z0-9 ]+(?= build))/: /\bhtc[ _\-]?([a-z0-9 ]+)/
		}], ["oppo", /\boppo[_]([a-z0-9]+)/], ["konka", /\bkonka[_\-]([a-z0-9]+)/], ["sonyericsson", /\bmt([a-z0-9]+)/], ["coolpad", /\bcoolpad[_ ]?([a-z0-9]+)/], ["lg", /\blg[\-]([a-z0-9]+)/], ["android", "android"], ["blackberry", "blackberry"]],
		r = [["wp",
		function(a) {
			return - 1 !== a.indexOf("windows phone ") ? /\bwindows phone (?:os )?([0-9.]+)/: -1 !== a.indexOf("xblwp") ? /\bxblwp([0-9.]+)/: -1 !== a.indexOf("zunewp") ? /\bzunewp([0-9.]+)/: "windows phone"
		}], ["windows", /\bwindows nt ([0-9.]+)/], ["macosx", /\bmac os x ([0-9._]+)/], ["ios",
		function(a) {
			return /\bcpu(?: iphone)? os /.test(a) ? /\bcpu(?: iphone)? os ([0-9._]+)/: -1 !== a.indexOf("iph os ") ? /\biph os ([0-9_]+)/: /\bios\b/
		}], ["yunos", /\baliyunos ([0-9.]+)/], ["android", /\bandroid[\/\- ]?([0-9.x]+)?/], ["chromeos", /\bcros i686 ([0-9.]+)/], ["linux", "linux"], ["windowsce", /\bwindows ce(?: ([0-9.]+))?/], ["symbian", /\bsymbian(?:os)?\/([0-9.]+)/], ["meego", /\bmeego\b/], ["blackberry", "blackberry"]],
		s = [["trident", p], ["webkit", /\bapplewebkit[\/]?([0-9.+]+)/], ["gecko", /\bgecko\/(\d+)/], ["presto", /\bpresto\/([0-9.]+)/], ["androidwebkit", /\bandroidwebkit\/([0-9.]+)/], ["coolpadwebkit", /\bcoolpadwebkit\/([0-9.]+)/]],
		t = [["sg", / se ([0-9.x]+)/], ["tw",
		function() {
			var a = g("theworld");
			return "undefined" != typeof a ? a: "theworld"
		}], ["360",
		function(a) {
			var b = g("360se");
			return "undefined" != typeof b ? b: -1 !== a.indexOf("360 aphone browser") ? /\b360 aphone browser \(([^\)]+)\)/: /\b360(?:se|ee|chrome|browser)\b/
		}], ["mx",
		function() {
			try {
				if (o && (o.mxVersion || o.max_version)) return {
					version: o.mxVersion || o.max_version
				}
			} catch(a) {}
			return /\bmaxthon(?:[ \/]([0-9.]+))?/
		}], ["qq", /\bm?qqbrowser\/([0-9.]+)/], ["green", "greenbrowser"], ["tt", /\btencenttraveler ([0-9.]+)/], ["lb",
		function(a) {
			if ( - 1 === a.indexOf("lbbrowser")) return ! 1;
			var b;
			try {
				o && o.LiebaoGetVersion && (b = o.LiebaoGetVersion())
			} catch(c) {}
			return {
				version: b || k
			}
		}], ["tao", /\btaobrowser\/([0-9.]+)/], ["fs", /\bcoolnovo\/([0-9.]+)/], ["sy", "saayaa"], ["baidu", /\bbidubrowser[ \/]([0-9.x]+)/], ["ie", p], ["mi", /\bmiuibrowser\/([0-9.]+)/], ["opera",
		function(a) {
			var b = /\bopera.+version\/([0-9.ab]+)/,
			c = /\bopr\/([0-9.]+)/;
			return b.test(a) ? b: c
		}], ["chrome", / (?:chrome|crios|crmo)\/([0-9.]+)/], ["uc",
		function(a) {
			return a.indexOf("ucbrowser/") >= 0 ? /\bucbrowser\/([0-9.]+)/: /\buc\/[0-9]/.test(a) ? /\buc\/([0-9.]+)/: a.indexOf("ucweb") >= 0 ? /\bucweb[\/]?([0-9.]+)?/: /\b(?:ucbrowser|uc)\b/
		}], ["android",
		function(a) {
			return - 1 !== a.indexOf("android") ? /\bversion\/([0-9.]+(?: beta)?)/: void 0
		}], ["safari", /\bversion\/([0-9.]+(?: beta)?)(?: mobile(?:\/[a-z0-9]+)?)? safari\//], ["webview", /\bcpu(?: iphone)? os (?:[0-9._]+).+\bapplewebkit\b/], ["firefox", /\bfirefox\/([0-9.ab]+)/], ["nokia", /\bnokiabrowser\/([0-9.]+)/]],
		u = {
			name: "na",
			version: k
		},
		v = function(a) {
			a = (a || "").toLowerCase();
			var b = {};
			i(a, q,
			function(a, c) {
				var d = parseFloat(c);
				b.device = {
					name: a,
					version: d,
					fullVersion: c
				},
				b.device[a] = d
			},
			b),
			i(a, r,
			function(a, c) {
				var d = parseFloat(c);
				b.os = {
					name: a,
					version: d,
					fullVersion: c
				},
				b.os[a] = d
			},
			b);
			var c = f(a);
			return i(a, s,
			function(a, d) {
				var e = d;
				c && (d = c.engineVersion || c.engineMode, e = c.engineMode);
				var f = parseFloat(d);
				b.engine = {
					name: a,
					version: f,
					fullVersion: d,
					mode: parseFloat(e),
					fullMode: e,
					compatible: c ? c.compatible: !1
				},
				b.engine[a] = f
			},
			b),
			i(a, t,
			function(a, d) {
				var e = d;
				c && ("ie" === a && (d = c.browserVersion), e = c.browserMode);
				var f = parseFloat(d);
				b.browser = {
					name: a,
					version: f,
					fullVersion: d,
					mode: parseFloat(e),
					fullMode: e,
					compatible: c ? c.compatible: !1
				},
				b.browser[a] = f
			},
			b),
			b
		};
		j = v(l + " " + m + " " + n),
		j.parse = v,
		a.Detector = j,
		"function" == typeof define && define("arale/detector/1.2.2/detector", [],
		function(a, b, c) {
			c.exports = j
		})
	} (window);
</script>
<script>
	!function(a) {
		function b() {
			return /\bcna=/.test(document.cookie)
		}
		function c(a, b, c) {
			b = b || "=";
			var d = [];
			for (var e in a) e && a.hasOwnProperty(e) && d.push(encodeURIComponent(e) + b + encodeURIComponent(a[e]));
			return d.join(c || "&")
		}
		function d() {
			var b = a.location.search,
			c = {};
			return b.replace(/([^?=&]+)(=([^&]*))?/g,
			function(a, b, d, e) {
				c[b] = e
			}),
			c
		}
		function e(a) {
			return "[object Function]" === Object.prototype.toString.call(a)
		}
		function f(a) {
			return "function" == typeof Array.isArray ? Array.isArray(a) : "[object Array]" === Object.prototype.toString.call(a)
		}
		function g(a) {
			var b = Array.prototype.slice.apply(arguments);
			if ("boolean" != typeof b[0] && b.unshift(a = !1), b.length < 2) return null;
			for (var c, d = 2,
			h = b[1], i = d, j = b.length; j > i; i++) if (c = b[i], c && "object" == typeof c) for (var k in c) {
				var l = c[k];
				if (l !== h && c.hasOwnProperty(k)) if (f(l)) h[k] = Array.prototype.concat.call(l);
				else if (a && l instanceof Object && !e(l) && !l.nodeType) {
					var m = h[k] || {};
					h[k] = g(!0, m, c[k])
				} else void 0 !== l && (h[k] = l)
			}
			return h
		}
		function h(a) {
			if ("http:" === o.protocol || "https:" === o.protocol) {
				var b = new Image(1, 1);
				b.onload = function() {
					b.onload = null
				},
				b.src = a
			} else try {
				var c = new XMLHttpRequest;
				c.open("GET", a, !0),
				c.onreadystatechange = function() {},
				c.send()
			} catch(d) {}
		}
		function i(a) {
			k.dispatchEvent(n, a,
			function() {
				k.click("titlebar-" + a)
			})
		}
		var j = a.Detector;
		"function" == typeof require && (j = require("arale/detector/1.2.2/detector"));
		var k, l, m = a,
		n = m.document,
		o = location,
		p = m.performance,
		q = "https:" !== o.protocol && "http:" !== o.protocol ? "https:": o.protocol,
		r = q + "//kcart.alipay.com/web/bi.do",
		s = q + "//kcart.alipay.com/web/1.do",
		t = q + "//log.mmstat.com/5.gif",
		u = 2e4,
		v = 8,
		w = "clk";
		p && p.timing ? l = p.timing.navigationStart: m._to && _to.start && (l = _to.start.getTime()),
		m.Tracker = k = function() {},
		k.prototype = {
			watch: function() {
				k.click("trac
1904
ker-watch")
			}
		},
		k.extend = function(a) {
			for (var b = 1,
			c = arguments.length; c > b; b++) for (var d in arguments[b]) arguments[b].hasOwnProperty(d) && (a[d] = arguments[b][d]);
			return a
		},
		k.version = "1.0",
		k.enabled = !0,
		k.debug = !1,
		k.seedName = "seed",
		k.minInterval = 1e3;
		for (var x, y, z = n.getElementsByTagName("meta"), A = 0, B = z.length; B > A; A++) if (y = z[A].getAttribute("name"), y && "abtest" == y.toLowerCase()) {
			x = z[A].getAttribute("content");
			break
		}
		if (k.dispatchEvent = function(a, b, c) {
			a.addEventListener ? a.addEventListener(b, c, !1) : a.attachEvent ? a.attachEvent("on" + b,
			function(b) {
				c.call(a, b)
			}) : a["on" + b] = function(b) {
				c.call(a, b)
			}
		},
		k.getTarget = function(a) {
			a = a.touches[0];
			var b = a.target || a.srcElement;
			try {
				if (b && 3 === b.nodeType) return b.parentNode
			} catch(c) {}
			return b
		},
		k.send = function(d, e, f) {
			if ("string" != typeof d || !d) throw new Error("Invalid page");
			var i = {
				ref: e || "-",
				pg: d || "",
				r: (new Date).getTime(),
				v: k.version
			};
			x && (i.ABTest = x, i.pg += (i.pg.indexOf("?") >= 0 ? "&": "?") + "ABTest=" + x),
			f && g(i, f),
			i = c(i),
			k.debug ? a.console && console.log("Tracker debug: %s.", i) : (h(r + "?" + i), "http:" !== o.protocol && "https:" !== o.protocol || b() || (i = c({
				url: s + "?" + i
			}), h(t + "?" + i)))
		},
		n && m.location) {
			var C = location.href,
			D = n.referrer,
			E = Math.random(),
			F = {
				screen: "-x-",
				color: "-",
				BIProfile: "page"
			};
			if (m.screen && (F.screen = screen.width + "x" + screen.height, F.sc = screen.colorDepth + "-bit"), F.utmhn = location.hostname, F.rnd = E, m.analytic_var && (F.ana = analytic_var), j) {
				var G, H, I, J, K = navigator.userAgent,
				L = "";
				G = (j.os.name || "na") + "/" + (j.os.version || "-1"),
				H = (j.browser.name || "na") + "/" + (j.browser.version || "-1"),
				I = (j.engine.name || "na") + "/" + (j.engine.version || "-1"),
				J = (j.device.name || "na") + "/" + (j.device.version || "-1"),
				L = G + "|" + I + "|" + H + "|" + J;
				var M, N = "-1";
				"anclient" == K && (M = d().ttid, M && (N = M.split("_")[2]), L = "android/-1|webkit/-1|tbwebview/" + N + "|android/-1"),
				L.indexOf("na") > -1 && !parseInt(Math.random() * v, 10) && (L += "|" + K),
				j.currentUA = L,
				F._clnt = L
			}
			if (k.send(C, D, F), D = C, F = {},
			!parseInt(Math.random() * v, 10)) {
				F.BIProfile = "load";
				var O = 0,
				P = 0,
				Q = 0,
				R = 100,
				S = function() {
					S.invoked || (S.invoked = !0, O = (m._to && _to.ready ? _to.ready.getTime() : (new Date).getTime()) - l, O > u && (T.invoked = !0, F.tm = "-x-", k.send(C, "", F)))
				},
				T = function() {
					O > u || T.invoked || (T.invoked = !0, P = (m._to && _to.end ? _to.end.getTime() : (new Date).getTime()) - l, p && p.timing && (O = p.timing.domContentLoadedEventStart - p.timing.navigationStart, P = p.timing.loadEventStart - p.timing.navigationStart, Q = p.timing.responseEnd - p.timing.responseStart), U())
				},
				U = function() {
					return O ? (O > P && (O = P - R), 10 > O || (F.tm = "" + O + "x" + P + "x" + Q, F.rnd = E, k.send(C, "", F)), void 0) : (setTimeout(U, 50), void 0)
				};
				l && (m._to && _to.ready ? S() : m.YAHOO && YAHOO.util && YAHOO.util.Event ? YAHOO.util.Event.onDOMReady(S) : m.jQuery ? jQuery(S) : m.Y && Y.on ? Y.on("domready", S) : S(), m._to && _to.end ? T() : (m.setTimeout(T, 8 * u), k.dispatchEvent(m, "load", T), k.dispatchEvent(m, "unload", T)))
			}
		}
		i("back"),
		i("title"),
		i("rightitem"),
		i("slaverightitem"),
		n && k.dispatchEvent(n, "touchstart",
		function(a) {
			var b = k.getTarget(a);
			if (b && b.nodeType) {
				for (; b && "HTML" != b.nodeName && "function" == typeof b.getAttribute && !b.getAttribute(k.seedName);) b = b.parentNode;
				if (b && 1 === b.nodeType && "HTML" != b.nodeName) {
					var c, d, e;
					"A" == b.nodeName && (d = b.getAttribute("href") || "", e = d.match(/[?&]_scType=([^&]+)/), e && (c = {
						_scType: e[1]
					})),
					k.click(b.getAttribute(k.seedName), c)
				}
			}
		}),
		k.click = function() {
			var a = {},
			b = location.href.split("?").shift(),
			d = b.indexOf(";jsessionid=");
			return d >= 0 && (b = b.substr(0, d)),
			a[w] = location.href,
			function(d, e) {
				if (d) {
					var f = d.split(":", 2);
					f.length >= 2 || f.unshift(w);
					var h = f[0];
					if (d = f[1]) {
						var i = {
							seed: d
						};
						e && g(i, e),
						i = c(i);
						var j, l = b + "?" + i;
						h && (j = {
							BIProfile: h
						}),
						k.send(l, a[h] || "", j),
						a[h] = l
					}
				}
			}
		} (),
		k.log = function(a, b) {
			k.click((b || "syslog") + ":" + a)
		},
		k.error = function(a) {
			k.click("syserr:" + a)
		},
		k.calc = function(a, b) {
			k.click("calc:" + a, {
				value: b
			})
		},
		"function" == typeof define && define("alipay/mtracker/1.0.3/mtracker", [],
		function(a, b, c) {
			c.export = k
		})
	} (window);
</script>
<!-- CMS:无线/无线wap全站通用/mtracker结束:wap/wap_common/mtracker.vm -->	<!-- CMS 无线监控埋点 结束 -->
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="format-detection" content="email=no"/>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0;"
          name="viewport"/>
    <link rel='stylesheet' href='https://a.alipayobjects.com/u/css/201212/1lu5dGaFum.css'/>
</head>
<body>
	<a href="https://m.alipay.com/offlineIndex.htm?sx=111" id="openApp" style="display: none">支付宝钱包客户端</a>
<script type="text/javascript">
    document.getElementById('openApp').onclick = function(e){
        // 通过iframe的方式试图打开APP,如果能正常打开,会直接切换到APP,并自动阻止a标签的默认行为
        // 否则打开a标签的href链接
       var ifrSrc = 'alipays://platformapi/startApp?appId=20000001&actionType=20000002&tabSelectedIndex=0';
      if(!ifrSrc){
        return;
      }
        var ifr = document.createElement('iframe');
        ifr.src = ifrSrc ;
        ifr.style.display = 'none';
        document.body.appendChild(ifr);
        setTimeout(function(){
            document.body.removeChild(ifr);
            
        },1000);
     
          };
   if(document.all) {
      document.getElementById('openApp').click();
   }
   // 其它浏览器
   else {
      var e = document.createEvent("MouseEvents");
      e.initEvent("click", true, true);
      document.getElementById("openApp").dispatchEvent(e);
   }
</script>
<div class="t-center pd-all10">
    <section><img src="https://i.alipayobjects.com/e/201306/SXTDtuxMN.png"/></section>
    <div class="fm-item">
              <a href="http://cdndownload.alipay.com/mgw/and/1/alipay_wap_dc.apk" class="flex btn btn-ok  mg-b8">免费下载</a>
               <p>m.alipay.com于2013年12月26日下线,请下载支付宝钱包继续使用支付宝服务</p>
    </div>
</div>

	<!-- CMS 无线监控埋点 开始 -->
	<!-- CMS:无线/无线wap全站通用/无线wap通用页脚开始:wap/wap_common/footer.vm --><!--智能用户行为分析相关-->
<script type="text/javascript" charset="utf-8" src="https://a.alipayobjects.com/ar/??alipay.smartracker-1.1.js"></script>
<!-- CMS:无线/无线wap全站通用/无线wap通用页脚结束:wap/wap_common/footer.vm -->	<!-- CMS 无线监控埋点 结束 -->
</body>
</html>









<!--悄悄的告诉你们,head标签内的js没有任何用处,无视即可 -->


开源中国-程序员在线工具:Git代码托管 API文档大全(120+) JS在线编辑演示 二维码 更多»

发表评论 回到顶部 网友评论(5)

  • 1楼:梁金堂 发表于 2014-04-27 13:21 回复此评论
    1. <a  href="https://m.alipay.com/offlineIndex.htm?sx=111"  id="openApp"  style="display: none">支付宝钱包客户端</a>  
    不想跳转到其他网页的话,可用  
    <a   href="#"   id="openApp"   style="display: none">支付宝钱包客户端</a>  
    甚至可以将" 支付宝钱包客户端 "去掉. 
    2. 其实可以在   
    document.body.appendChild(ifr);   
    后添加   
    document.body.removeChild(ifr);   
    因为已经触发了自定义协议的链接,该生效的也生效了.然后又立刻移除它,避免部分浏览器报未知协议异常.
  • 2楼:梁金堂 发表于 2014-04-27 13:33 回复此评论
    此方法是进去网页就自动尝试切换到本地app,
    手动切换不用这么麻烦,直接
    <a href="xxx://xxx.xxxx">本地app</a>
  • 3楼:幻影浪子 发表于 2015-10-26 15:43 回复此评论
    小米上似乎不行。出现 

    ERR_UNKNOWN_URL_SCHEME

  • 4楼:幻影浪子 发表于 2015-10-26 17:07 回复此评论
    ```

    mWebView.setWebViewClient(new WebViewClient() {


    @Override

    public boolean shouldOverrideUrlLoading(WebView view, String url) {

    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));

    return true;

    }

    });


    ```
  • 5楼:幻影浪子 发表于 2015-10-26 17:08 回复此评论
    在小米手机上,加了上面这段代码处理。
开源从代码分享开始 分享代码
梁金堂的其它代码 全部(18)...