How to find out if a page is opened in embedded browser

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.

Upvotes: 6

Views: 2326

Answers (1)

NapkinHD
NapkinHD

Reputation: 162

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.

Upvotes: 0

Related Questions