wap尝试调取app(网易新闻为例)

Posted 橙云生

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wap尝试调取app(网易新闻为例)相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>调起网易新闻app</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta content="yes" name="apple-touch-fullscreen">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no" />

		<style>
			a {
				display: block;
				width: ;
				text-decoration: none;
				background-color: #20A0FF;
				text-align: center;
				height: 2rem;
				line-height: 2rem;
				margin: 3rem auto;
			}
		</style>
	</head>

	<body>
		<a id="openApp">使用网易新闻客户端打开</a>
		<script>
			var s = document.getElementById("openApp");
			s.onclick = function() {
				var url = ‘newsapp://topic/S1515729142180?s=jiguang&spsug=ug&spsugdate=0&spsugextend=0‘;
				testApp(url);
			}
			function testApp(url) {
				var timeout, hasApp = true;
				var t1 = Date.now();
				var ifr = document.createElement("iframe");
				ifr.setAttribute(‘src‘, url);
				ifr.style.display = "none";
				document.body.appendChild(ifr);
				timeout = setTimeout(function() {
					var t2 = Date.now();
					if(t2 - t1 < 2000) {
						hasApp = false;
						if(is_ios()) {
							location.href = "http://3g.163.com/links/4633";
							return;
						}
						location.href = "http://3g.163.com/links/4636";
					}
				}, 1000);

				location.href = url;
			}
			function is_IOS() {
				var userAgent = ‘navigator‘ in window && ‘userAgent‘ in navigator && navigator.userAgent.toLowerCase() || ‘‘;
				if(/iphone/i.test(userAgent) || /ipad/i.test(userAgent) || /ipod/i.test(userAgent)) {
					return true
				} else {
					return false;
				};
			}
		</script>
	</body>

</html>

  

以上是关于wap尝试调取app(网易新闻为例)的主要内容,如果未能解决你的问题,请参考以下文章

网易新闻部分框架

Reveal使用教程-使用Reveal查看任意iOS App的图层结构

Android最新主流新闻app功能实现。仿网易,搜狐等新闻客户端实现展示

网易云易盾中标浙报反作弊服务 助力浙江新闻App健康发展

AOP技术在Android网易新闻App中的应用

哪一个新闻类app比较好