How to detect if the user is accessing by a webview app

0
Hello, I created a webview app for my site because it is 100% responsive and adapts well on mobile devices, but in my menu there is a link for you to download this application, I would like to know how I can identify a webview access since I want hide this menu when using the webview app.

Ex:

Where is MUFLIX PLAY, I would like to hide when accessed through webview: P

    
asked by anonymous 29.07.2018 / 02:10

1 answer

0

Normally, to detect whether a user is accessing the page in an iframe , with JavaScript, window.top to check if it is equal to window current. That is, if window !== window.top is true , then the user is in an iframe . Does not that work for you too? And if it's done, for example, in JavaScript:

// Se estiver em um iframe...
if (window !== window.top) {

  // Adicionar a class "webview" no body...
  document.body.classList.add("webview");
}

... and in CSS:

body.webview {
  /* Estilo aqui... */
}
    
29.07.2018 / 22:21