如何检测Facebook应用内浏览器? [英] How to detect Facebook in-app browser?
本文介绍了如何检测Facebook应用内浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
用户代理的核心区别是什么?
我不想知道它是否是唯一的移动/ ios / chrome。我需要知道用户代理是否具体来自 Facebook应用内浏览器
解决方案
您可以检查对于用户代理中的FBAN / FBAV。
示例代码为@sascha建议
函数isFacebookApp(){
var ua = navigator.userAgent || navigator.vendor || window.opera;
return(ua.indexOf(FBAN)> -1)|| (ua.indexOf(FBAV)> -1);
}
Have you had any experience in Facebook in-app browser detection? What's the core difference in user agent?
I don't want to know if it is a only mobile/ios/chrome. I need to know whether user agent is specific from Facebook in-app browser
解决方案
You can check for FBAN / FBAV in the user agent.
Check this link: Facebook user agent
Sample code as @sascha suggested
function isFacebookApp() {
var ua = navigator.userAgent || navigator.vendor || window.opera;
return (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1);
}
这篇关于如何检测Facebook应用内浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文