Display specific browser warning

Asked

Viewed 31 times

0

I have a web application that works well in all browsers.

It turns out that I had to develop a Feature that is not responding well in the browser that is already installed on Samsung smartphones. From my Analytics reports, a good portion of my users use this browser.

I would like to display a warning logo when loading the page for all users who make use of this browser, stating that it is best that they use Chrome or Opera, for example.

This has to be done right on page loading, before they access this Feature that I recently developed.

Can someone help me?

From now on, thank you!!!

  • Have you tried this https://www.sitepoint.com/detect-mobile-devices-jquery/ partner ?

  • I know this script, I may have to adapt it to a specific browser.. https://jsfiddle.net/9atsffau/

1 answer

1

You can detect the user with the command : navigator.userAgent.match(REGEX DO NAVEGADOR A CHECAR);

For example,

var isMobile = {
    Android: function() {
        return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function() {
        return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function() {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function() {
        return navigator.userAgent.match(/Opera Mini/i);
    },
    Windows: function() {
        return navigator.userAgent.match(/IEMobile/i);
    },
    any: function() {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
    }
};

So on your onload you can call : if( isMobile.Android() ) alert('Android');

This way, I believe you have to see which "useragent" Samsung browser sends and treat it.

There are also some libraries that help with that, but I’ve never used it, for example Mobileesp project.

Code snippets above were taken from this website.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.