How to check browser version easily

  • Hello,

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

    Code
    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 :

    Code
    indexoftxt(indexsafariversion, get(device.safariversion), ".");
    subtxt(majorsafariversion, get(device.safariversion), 0, get(indexsafariversion));
    if(majorsafariversion GE 11,
      trace('VERIFED');
    ,
      trace('NOT VERIFIED');
    );

    Einmal editiert, zuletzt von benji33 (20. Juni 2018 um 12:44)

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

    Code
    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, ...);

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!