Discuss Scratch

TheLogFather
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

This is a continuation of my previous OS-detector project, but targeted at Scratch 3:


https://beta.scratch.mit.edu/#244112656
(The project isn't shared so far, since it really doesn't do anything for Scratch 2 beyond what the previous did.)

I'm currently getting distinct values for Safari vs FF vs Chrome on macOS (10.13.3), as well as other distinct values on iOS (with Safari, at least).

So I'm curious if these values really are distinct to a browser (e.g. via JS implementation, which could easily mean the values might change with different versions of the same browser), or if there are other factors at work that might mean they could depend upon other factors unrelated to browser…


I'd also obviously be interested in values for various browsers on various versions of Windows (especially useful if you include whether it's 32 or 64 bit app & OS), as well as various Linux distros (is it even possible there could be differences between distros?)


Post your specs and test values here…

TNX1E+6

Last edited by TheLogFather (Oct. 6, 2018 16:20:19)

jokebookservice1
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

Very cool!

Prediction: Chrome on MacOS
Reality: Chrome on Windows 10 (64 bit)
TheLogFather
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

jokebookservice1 wrote:

Very cool!
Prediction: Chrome on MacOS
Reality: Chrome on Windows 10 (64 bit)
Oh, very interesting…!

I was wondering if the fact it's JS could mean it'd end up only being able to distinguish browser, and no longer distinguish OS.

EDIT: Oh, wait… the value for the power test is not exactly the same as mine on Chrome (so the project would've said Chrome, but just guessed it might be mac, right?), so maybe there is some hope (–then again, maybe it's just differences in version of Chrome…? Mine is 69.0.3497.100 for Mac.)

Last edited by TheLogFather (Oct. 6, 2018 17:00:30)

jokebookservice1
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

My Chrome version is the same: Version 69.0.3497.100 (Official Build) (64-bit) on Windows.

The project placed “on Mac” in parenthesis, if that's relevant

Last edited by jokebookservice1 (Oct. 6, 2018 17:27:53)

bybb
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

Chrome on Windows 10 (64-bit) https://cookies.are-bad.ga/tsFOBGnD.png Detected as Chrome on MacOS
Firefox on WSL (Kali) on Windows 10 (64-bit) https://communists.are-bad.ga/197ZGCh6.png Detected as Chrome on MacOS
TheLogFather
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

bybb wrote:

Chrome on Windows 10 (64-bit) https://cookies.are-bad.ga/tsFOBGnD.png Detected as Chrome on MacOS
Firefox on WSL (Kali) on Windows 10 (64-bit) https://communists.are-bad.ga/197ZGCh6.png Detected as Chrome on MacOS
OK, wow, so the second one gave all exactly the same values as Chrome on Mac, even though it's FF on Linux running within Win…
(And the first one gave the same as jokebookservice1 above, with same specs.)

I've edited the project a little now so that it doesn't make a guess it's on macOS when the values are not exactly as expected, but instead says “(not macOS?)”. Still kept it saying macOS when they are all as expected, despite above result – for now…

Last edited by TheLogFather (Oct. 6, 2018 18:13:25)

bybb
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

TheLogFather wrote:

OK, wow, so the second one gave all exactly the same values as Chrome on Mac, even though it's FF on Linux
I'd just like to interject for a moment. What you're referring to as Linux, is in fact, GNU/NT, or as I've recently taken to calling it, GNU plus NT.

WSL is not Linux, it's a GNU system (with other things the Distro normally has), ran by translating Linux syscalls directly to NT syscalls and runs them natively.
XayCraft360
Scratcher
100+ posts

Tabulating OS/browser detection values for Scratch 3

Expects: maybe safari? On iOS
Reality: iOS 11.1, Unknown Browser (Safari?), No Flash version detected

Seams to work fine

Last edited by XayCraft360 (Oct. 6, 2018 19:56:30)

Jonathan50
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

It correctly guessed Scratch 3 on Safari on macOS: http://i67.tinypic.com/r0poit.png

It also misdetected Firefox on real GNU/Linux (Lubuntu 16.04) as Chrome on macOS. (Also for some reason Scratch 3.0 won't start at all on GNOME Web/WebKitGTK+, even though it works fine on Safari 11.)

It guessed Firefox on Windows 7 32-bit to be Chrome, not on macOS:

Last edited by Jonathan50 (Oct. 6, 2018 21:31:11)

badatprogrammingibe
Scratcher
500+ posts

Tabulating OS/browser detection values for Scratch 3

It seems that it believes I'm using chrome, while I am currently using waterfox. It however correctly guessed the operating system,
MrFlash67
Scratcher
500+ posts

Tabulating OS/browser detection values for Scratch 3

I'm also getting FF on Linux appearing as Chrome on MacOS -

(4th gen Intel processor, Arch Linux, FF 62, though I'm not sure any of those would make a difference)
TheLogFather
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

MrFlash67 wrote:

I'm also getting FF on Linux appearing as Chrome on MacOS
Hmmm, interesting – all values are the same…

I don't know if that means the algorithm is identical, so there's no way to distinguish, or if it's possible there's some difference in there somewhere if we spend long enough trawling through various tests with different size arguments to try find it. (It could be that the algorithms are near enough the same for the range of values it uses in the tests.)


bybb wrote:

WSL is not Linux, it's a GNU system (with other things the Distro normally has), ran by translating Linux syscalls directly to NT syscalls and runs them natively.
May well be, since I wouldn't know anything about that (have almost no experience with Windows, nor running anything within it).

OTOH, I have a feeling the whole ‘native’ thing isn't relevant when it comes to JS in these tests…? It certainly seems as though the JS implementations for sin & cos are distinct from the ‘native’ ones (i.e. in the system libs), since they give different values (yet always get -272597 on all browsers & OSes in Scratch 3, which was unexpected) – running the same sin/cos test in python gives the same value (212270) as in Scratch 2 (i.e. Flash), which suggests that's the Mac's actual ‘native’ sin & cos they're tapping into (I really should give it a go in C to check that…)

In other words, it's possible it's only down to the browser's JS implementation itself – and the results above suggest that's (mostly) the case (i.e. that they're much more similar on the same/similar browser across OSes).

Still, there are some differences sometimes, so it gives some hope there could be a way to (ab)use them to (very often) detect both OS & browser…

Last edited by TheLogFather (Oct. 7, 2018 12:34:14)

ninjagolloyd
Scratcher
500+ posts

Tabulating OS/browser detection values for Scratch 3

MrFlash67 wrote:

I'm also getting FF on Linux appearing as Chrome on MacOS -

(4th gen Intel processor, Arch Linux, FF 62, though I'm not sure any of those would make a difference)
same values, Fedora 28, FF 62, Pentium 4405U
adsuri
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

Guessed: Scratch 3, Chrome, (Not macOS)
Reality: My browser / operating system: Android Linux 7.1.1, Chrome 69.0.3497.100, No Flash version detected

Good enough…
Sigton
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3


My browser / operating system: Windows NT 10.0, Chrome 69.0.3497.100, No Flash version detected

Pretty good

Sigton
adsuri
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

adsuri wrote:

Guessed: Scratch 3, Chrome, (Not macOS)
Reality: My browser / operating system: Android Linux 7.1.1, Chrome 69.0.3497.100, No Flash version detected

Good enough…
*oof* just realized I forgot to take screenshot of values *oof*
Jonathan50
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

TheLogFather wrote:

OTOH, I have a feeling the whole ‘native’ thing isn't relevant when it comes to JS in these tests…? It certainly seems as though the JS implementations for sin & cos are distinct from the ‘native’ ones (i.e. in the system libs), since they give different values (yet always get -272597 on all browsers & OSes in Scratch 3, which was unexpected) – running the same sin/cos test in python gives the same value (212270) as in Scratch 2 (i.e. Flash), which suggests that's the Mac's actual ‘native’ sin & cos they're tapping into (I really should give it a go in C to check that…)

In other words, it's possible it's only down to the browser's JS implementation itself – and the results above suggest that's (mostly) the case (i.e. that they're much more similar on the same/similar browser across OSes).
Huh? Isn't it the other way around, since it can't distinguish between Chrome and Firefox (though it can distinguish between Chrome/Firefox and Safari on macOS) on the same operating system, but it can distinguish between macOS (and GNU/Linux) and Windows?

Last edited by Jonathan50 (Oct. 7, 2018 22:05:32)

TheLogFather
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

Jonathan50 wrote:

Huh? Isn't it the other way around, since it can't distinguish between Chrome and Firefox (though it can distinguish between Chrome/Firefox and Safari on macOS) on the same operating system, but it can distinguish between macOS (and GNU/Linux) and Windows?
I don't think so.

Let's start with the Scratch 2 values for the sin/cos test…

The values do appear to be OS-dependent for this, and unrelated to the browser (also unrelated to the Flash version, at least over reasonably recent versions). My conjecture is that Flash is using the system libs implementation of sin & cos. (BTW, Windows is an oddity for the Flash case, since there are a handful of different values that test could give that only appeared for Windows, and that were clearly not related to the browser nor the version of Win, all [most?] appearing all the way from XP to 10. I'd guess the sin/cos implementation(s?) in Win might have different behaviours depending upon very subtle characteristics of the linking/compilation and maybe even some system prefs, etc?)

As further evidence that Flash is using ‘native’ sin & cos, I'd note that coding that same sin/cos test into python on macOS gives exactly the same as the Mac value from Scratch 2 (i.e. Flash). –I really should test it from within C too, just to be sure…


Now returning to Scratch 3, and looking over all the values, many of them are exactly the same across OSes (Mac/Linux/Win) – in particular, the sin/cos test gives the same, even though that value is clearly different compared to any ‘native’ sin/cos implementation (i.e. as accessed by Flash through Scratch 2).

If it's really the case that Flash is accessing the ‘native’ sin/cos, then this suggests the JS implementation on the major browsers (yet to see Edge/IE, if possible) doesn't use this ‘native’ implementation, but has its own implementation which is actually the same across browsers and OSes (since they all give the same value of -272597).


In Scratch 3, the values for all tests (except ‘exp test’ for some unknown reason) are also the same for Safari on macOS vs iOS. And the values from Chrome and FF tend to be largely the same as each other on macOS (apart from tan & power tests), but are mostly different from the Safari values.

Yet they're also all the same between Chrome on macOS and FF on Linux, and Sigton's values above for Chrome on Win are all the same as Chrome on macOS, apart from the power test (again, for some unknown reason).


The above lead me to conclude that it seems likely the implementations of these operations within the JS engines of Chrome and FF are (pretty much) the same on all OSes, with minor differences occurring occasionally for some obscure reason, while some of the implementations for Safari are somewhat different from Chrome/FF (yet the same on Safari across macOS and iOS, again with obscure minor differences).


If anyone has some alternative explanation (or maybe, unlike me, has actually bothered to look into the implementations of various transcendental mathematical operations in the JS engines across the browsers), then I'd be very happy to listen…

Last edited by TheLogFather (Oct. 8, 2018 15:29:11)

bybb
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

TheLogFather wrote:

yet to see Edge/IE, if possible
Scratch 3 doesn't support IE, and the project freezes my Edge, but Edge is just a generic chromium based browser (and a slightly outdated one at that) so you'd most likely run in to the same problem.
TheLogFather
Scratcher
1000+ posts

Tabulating OS/browser detection values for Scratch 3

bybb wrote:

TheLogFather wrote:

yet to see Edge/IE, if possible
Scratch 3 doesn't support IE, and the project freezes my Edge, but Edge is just a generic chromium based browser (and a slightly outdated one at that) so you'd most likely run in to the same problem.
Yeah, hence the “if possible” (I mean, this *is* AT, right, so I'm sure someone could remove the checks that prevent it from running, and it'd hopefully manage to run at least well enough to get the values out…)

Powered by DjangoBB