Find out if its the latest browser version.

bfuchs
bfuchs used Ask the Experts™
on
Hi Experts,

Our application is designed with Caspio tools, and they only support 4 browsers with the latest versions.

They wrote for us a utility that will keep track of which browser/version the users have used to log into our app.

How do I determine if for example those two stored versions below are the latest or not?

Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/601.7.8 (KHTML, like Gecko) Version/9.1.3 Safari/537.86.7

Open in new window


Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
NoahHardware Tester and Debugger

Commented:
@bfuchs Hi there! :)

You can try this simple tool from the link below. It's for PC and it uses some simple Javascript to notify you there is an update.
 
Reference: https://browser-update.org/
leakim971Multitechnician
Top Expert 2014
Commented:
Hi,

I like this script to detect the browser
https://github.com/lancedikson/bowser#filtering-browsers
What is great is you can set a platform desktop / mobile, browser ...

Just to get the browser info
const browser = Bowser.getParser(window.navigator.userAgent);
console.log(`The current browser name is "${browser.getBrowserName()}"`);

Open in new window


Or if you want to check if it meet the requirements (you can set what you want)

const browser = Bowser.getParser(window.navigator.userAgent);
const isValidBrowser = browser.satisfies({
  // declare browsers per OS
  windows: {
    "internet explorer": ">10",
  },
  macos: {
    safari: ">10.1"
  },

  // per platform (mobile, desktop or tablet)
  mobile: {
    safari: '>=9',
    'android browser': '>3.10'
  },

  // or in general
  chrome: "~20.1.1432",
  firefox: ">31",
  opera: ">=22",

  // also supports equality operator
  chrome: "=20.1.1432", // will match particular build only

  // and loose-equality operator
  chrome: "~20",        // will match any 20.* sub-version
  chrome: "~20.1"       // will match any 20.1.* sub-version (20.1.19 as well as 20.1.12.42-alpha.1)
});

Open in new window

Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

@lenamtl,

We have code in place similar to what you have posted, see attached.

Is there any way I can get that info stored in a table (Safari=14, Chrome = 78...), and then run a code that will auto check and update this constantly?

Thanks,
Ben
common.js
@Noah,

I just tried the code provided there on your link and nothing happens.

<script> 
var $buoop = {required:{e:-4,f:-3,o:-3,s:-1,c:78},insecure:true,api:2019.11 }; 
function $buo_f(){ 
 var e = document.createElement("script"); 
 e.src = "//browser-update.org/update.min.js"; 
 document.body.appendChild(e);
};
try {document.addEventListener("DOMContentLoaded", $buo_f,false)}
catch(e){window.attachEvent("onload", $buo_f)}
</script>

Open in new window

Tested the above with chrome.

Thanks,
Ben
leakim971Multitechnician
Top Expert 2014

Commented:
your application is only for MS Windows and Mac OS ? What about Tablet OS, Smartphone OS, Linux OS ?
Hi,

We need something workable at all platforms.
What do you suggest?

Thanks,
Ben
leakim971Multitechnician
Top Expert 2014

Commented:
so you need all browser versions for every platform
Only those 4 browsers listed on Caspio website as supported..

Thanks,
Ben
Hi,

The script I proposed have all kind of browser already listed for detection  https://github.com/lancedikson/bowser/tree/master/src

Usually we check only for minimal requirement.
Which browsers minimal version is needed to run your code correctly.

To my opinion you don't need to check if the user have the latest version.
You may change the minimal requirement when you update your code.

You can check if the browser support a specific feature
Does it support  HTML5 like video, canvas, localstorage etc
To perform those check you can use  https://modernizr.com/docs

A good article http://diveintohtml5.info/detect.html#techniques
Hi lenamtl,

The script I proposed have all kind of browser already listed for detection

What does that script has to offer better from what we already have in place?

To my opinion you don't need to check if the user have the latest version.
My issue is as follows, we have some fields set as required which are not coming in filled, meaning users are able to submit records w/o filling all required fields.
According to Caspio, this is due to users not using the latest browser version, therefore we want force users to have latest version (at least for the time being) so we can either prove or rule out being this the culprit...

Any idea how to make the above work?

Thanks,
Ben
Hi,

JavaScript form validation can be bypassed using the browser console by any user.
So even with the latest browser version it won't prevent user to bypassed required or any other JavaScript validation.

For more security and for data integrity you should ask Caspio team  how to add server side validation for your form.

What I would do is ask them what is the minimum requirement and do the check based on that.
That will required less code and faster to detect and reliable as your script won't depend from another website / service.

But if you really need to get actual browser version you will need to use an API to fetch the version
so you can compare using these values, this can be slow, this won't work if the provider service is down.

https://github.com/Nyalab/caniuse-api
https://developers.whatismybrowser.com/api/docs/v2/integration-guide/
Hi,

What I would do is ask them what is the minimum requirement and do the check based on that.
I've done that a couple of times in the past, and their answer always was something like "it should work with any of later versions in general, however they can only provide us with professional services support (custom coding), if we are using the latest version of browser available".

The 2nd link above seems to be providing what I need, however its sounds a bit too complicate for me to implement.

Wondering if this can't be accomplished in a simpler way, like the one Noah posted above (if only that would work...)?

Thanks,
Ben
Hi,

Minimal requirement is the simpler way.
Having server side validation will prevent issue if Javascript validation is bypassed or not working because of the browser settings.

Checking for latest browser using an API may help but won't prevent user or browser to bypass Javascript validation.
Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial