I'm working on a mobile site right now. But it performs a little bit different in a normal mobile browser and an in-app browser(when you scan the QR code or click a link in a social network app, for example). I use navigator.userAgent.match(/ipad|ipod|iphone|android/i)
to detect mobile site and run corresponding javascript function, so I guess maybe this detection method doesn't work in in-app browser. Is there a universal way to detect all the mobile browsers including in-app one?
There are user agent string variations even for in-app browsers. You can sometimes use those to detect specific in-app browsers: for instance, the Facebook on both iOS and Android contains the string FBAV (possibly short for Facebook Application Version?).
A working general solution for iOS is here: detect ipad/iphone webview via javascript
I'm not aware of a general solution for Android.