You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

benji33

Intermediate

  • "benji33" started this thread

Posts: 244

Location: France

Occupation: Senior Software engineer

  • Send private message

1

Wednesday, June 20th 2018, 11:27am

How to check browser version easily

Hello,

I've tested this code with Safari 11.1.1 on macOS.

Source code

1
2
3
4
5
if(device.safariversion GE 11,
  trace('VERIFED');
,
  trace('NOT VERIFIED');
);


It returns NOT VERIFIED. The check is VERIFED with single "." version as iOS ones but not with macOS ones due to the string comparison.
There is a way to do it easily without a string parse?

Better solution at this time :

Source code

1
2
3
4
5
6
7
indexoftxt(indexsafariversion, get(device.safariversion), ".");
subtxt(majorsafariversion, get(device.safariversion), 0, get(indexsafariversion));
if(majorsafariversion GE 11,
  trace('VERIFED');
,
  trace('NOT VERIFIED');
);

This post has been edited 1 times, last edit by "benji33" (Jun 20th 2018, 12:44pm)


2

Wednesday, June 20th 2018, 1:22pm

Here another possibility by converting the Safari version-string to a Number (using only the major and minor numbers):

Source code

1
2
3
4
5
txtsplit(device.safariversion, '.', majorver, minorver);
calc(safariversionnumber, majorver + minorver/10);
if(safariversionnumber GE 11.0, ...);
if(safariversionnumber GE 11.1, ...);
if(safariversionnumber GE 11.2, ...);

benji33

Intermediate

  • "benji33" started this thread

Posts: 244

Location: France

Occupation: Senior Software engineer

  • Send private message

3

Wednesday, June 20th 2018, 2:18pm

Thanks for this solution