我已经完成以下代码来检测网站中的FB应用内浏览器:-我知道如果检测到FB-In App浏览器时如何添加重定向window.location.href = "http://www.example123website.com";
?
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>App Link</title>
<script language="JavaScript" type="text/JavaScript">
function isFacebookApp() {
var ua = navigator.userAgent || navigator.vendor || window.opera;
window.location.href = "http://www.example123website.com";
return (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1);
}
</script>
</head>
<body>
</body>
</html>
答案 0 :(得分:0)
代码如下:
如果isFacebookApp
成功:
function isFacebookApp() {
var ua = navigator.userAgent || navigator.vendor || window.opera;
var s = (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1) ;
if(s> -1 && s!=false)
{
window.location.href = "http://www.example123website.com";
}
}