I have a component in my website which used to show a download link, I want to remove this component whenever client visits my website using android web view.
Expected to have a function in js that determines this but couldn't find any
I have a component in my website which used to show a download link, I want to remove this component whenever client visits my website using android web view.
Expected to have a function in js that determines this but couldn't find any
You can try using the navigator.userAgent property to determine whether the client is using android web view.
function checkForWebView() {
const userAgent = navigator.userAgent;
if (userAgent.includes('Android')) {
// The client is using an Android device.
// Check if the user agent string contains the name of a known Android web view.
if (userAgent.includes('Chrome') || userAgent.includes('Firefox') || userAgent.includes('SamsungBrowser')) {
// The client is using a web view.
return true;
} else {
// The client is not using a web view.
return false;
}
} else {
// The client is not using an Android device.
return false;
}
}