Is there a way that can tell my page (the javascript code to be exact) that it is run not in a standalone browser but through embedded one e.g. WebView, Webbrowser control etc.
Asked
Active
Viewed 1,571 times
1 Answers
1
You can try to detect the most common browsers by checking the User agent string and write a javascript/jQuery function like:
$(document).ready(function(){
if(!browser===Chrome||IE||Safari||FireFox){
YOUR_CODE
}
else{
DO_NOTHING
}
});
But this is not the best practise. To achive this if(!browser===Chrome||...)-functionality have a look at this thread.
There is everything explained in a comprehensive way.

NapkinHD
- 166
- 8
- 23
-
The browser I have in mind and need to identify reports as IE7:) `Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; Tablet PC 2.0; .NET4.0E)` so it shows as a browser but in fact it is an embedded control – Lukasz 'Severiaan' Grela Feb 05 '16 at 13:45
-
Okay, thats intresting. What is that for a browser you need? Run the follwing Code snipet in your browser and tell me, what your UserAgent String says `var ua = navigator.userAgent.toLowerCase(); var check = function(r) { return r.test(ua); };` Edit: Where is this browser embedded? In a nativ application or somewhere else? – NapkinHD Feb 05 '16 at 13:53