Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to detect with javascript if browser is an android webview?

I am creating a webapp and the user could only have acces with the android webview? Can i detect android webview with javascript?

like image 836
robind38 Avatar asked Mar 30 '12 12:03

robind38


1 Answers

From http://developer.android.com/guide/webapps/webview.html#EnablingJavaScript

For example, if you're developing a web application that's designed specifically for the WebView in your Android application, then you can define a custom user agent string with setUserAgentString(), then query the custom user agent in your web page to verify that the client requesting your web page is actually your Android application.

like image 83
Marvin Emil Brach Avatar answered Oct 24 '22 23:10

Marvin Emil Brach