Ishara Abeykoon
Ishara Abeykoon

Reputation: 558

What is the solid way to find out whether the User in on a webview or a browser in reactjs

What is the most solid way to check whether a user is on a webview inside a App or another web browser?

We can get details of the OS running using javascript window.navigator.userAgent, but is there a way to specifically identify whether user is using a webview or a web browser?

Upvotes: 1

Views: 2605

Answers (1)

Ishara Abeykoon
Ishara Abeykoon

Reputation: 558

Following simple check worked out for a webview inside android application, not sure how it'll work on IOS though,

  if( navigator.userAgent.includes ('wv')){
     //Inside the webview      
  }else{
     //Not a webview
  }

Upvotes: 2

Related Questions