Friday, 15 August 2014

javascript - How to check if device is Windows Surface Tablet and browser is chrome or IE -


How does it know that the device is the Windows Surface tablet and the browser is using chrome or IE javascript I have tried the following code

  function is_touch_device () {try {document.createEvent ("TouchEvent"); Back true; } Hold (e) {return false; }} If (is_touch_device ()) {if navigator.userAgent.toLowerCase () IndexOf ('chrome') & gt; -1) {// some stuff}}  

I have been searching for the user but I'm not getting the exact surface for how to know that the device is surface and the Chrome browser Or IE is

Using the Navigator object, you can access the data field

< Pre> navigator.appname & lt; - The name of the app can be misleading, hence the app coden navigator.application name is also found; & Lt; - Alternative name navigator. Platform; & Lt; - User is on platform


No comments:

Post a Comment