#javascript #html #redirect
#javascript #HTML #перенаправление
Вопрос:
Я выполнил этот код для обнаружения FB в браузере приложений на моем веб-сайте: — Мой Я знаю, как добавить перенаправление window.location.href = "http://www.example123website.com";
при обнаружении FB в браузере приложений?
<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>
Комментарии:
1. что вы имеете в виду .. если
isFacebookApp
получится, то перенаправить?
Ответ №1:
Вот код:
если isFacebookApp
удастся:
function isFacebookApp() {
var ua = navigator.userAgent || navigator.vendor || window.opera;
var s = (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1) ;
if(s> -1 amp;amp; s!=false)
{
window.location.href = "http://www.example123website.com";
}
}