<!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; ; 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>