--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/native-client-discuss/-/PJKpRqkpS1kJ.
To post to this group, send email to native-cli...@googlegroups.com.
To unsubscribe from this group, send email to native-client-di...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/native-client-discuss?hl=en.
Try reading navigator.platform.http://stackoverflow.com/questions/7044944/jquery-javascript-to-detect-os-without-a-plugin
Possible values in WebKit (most of which you can probably ignore) are here:
E.g., I get "Linux x86_64" locally.
On Tue, Dec 18, 2012 at 12:17 PM, Bennet Yee (余仕斌) <b...@google.com> wrote:
presumably you are thinking of packaged apps and not hosted apps. one way would be to include a set of tiny nexes that return their own arch in response to a postmessage from javascript. :-) but i suspect you want something even lighter weight. unfortunately i don't know of any javascript magic that'll do that; maybe somebody else has more clue?-bsy
On Tue, Dec 18, 2012 at 10:11 AM, Reed Riley <john.re...@gmail.com> wrote:
Is there any way to detect the NaCl architecture (32/64/ARM) that a client is going to use from within JavaScript?Specifically, I don't care at all what the actual architecture is, I just want to know which objects NaCl's going to load from the manifest.The application being downloaded is pretty large, so I'm caching it explicitly using the HTML5 Filesystem API - but I don't want to download content for unnecessary architectures.Thanks,Reed
--
There's some complexity in mapping operating system and browser to NaCl bitness that I'd rather avoid maintaining.
In particular, the default Chrome for 64-bit OS X uses 32-bit NaCl
, and some other operating systems (e.g., Linux) allow you to install 32-bit packages on 64-bit operating systems.
If necessary, I'll write a small 'bitness detection' NaCl executable and use that to figure out which binaries the user is going to need - but I'd prefer to avoid that if there's some easy way to ask the NaCl runtime this sort of question from Javascript.
On Wed, Dec 19, 2012 at 12:29 PM, Reed Riley <john.re...@gmail.com> wrote:
There's some complexity in mapping operating system and browser to NaCl bitness that I'd rather avoid maintaining.I agree, it's not ideal. I'm not aware of any better way in JS (maybe others are). In general, the web platform (outside NaCl, at least) tries to insulate you from platform differences.In particular, the default Chrome for 64-bit OS X uses 32-bit NaClWe don't ship 64-bit Chrome to OS X, so I think you can safely assume Mac implies 32-bit NaCl.
, and some other operating systems (e.g., Linux) allow you to install 32-bit packages on 64-bit operating systems.I'm fairly sure the 32-bit Chrome will report 32-bit (i686), since it's determined at compile-time. I also think it will use the 32-bit x86 sandbox. So that should also work fine But maybe somebody can confirm that a 32-bit build of Chrome on Linux NaCl.Windows is weird; we ship only 32-bit Chrome for Windows, but if run on a 64-bit version of Windows, we load a 64-bit nexe. But it appears that platform is actually determined dynamically on Windows, so I actually think it would work:
Caveat: I haven't tried this. Even if it works, I agree that it's icky and brittle.If necessary, I'll write a small 'bitness detection' NaCl executable and use that to figure out which binaries the user is going to need - but I'd prefer to avoid that if there's some easy way to ask the NaCl runtime this sort of question from Javascript.We don't even have a way for JavaScript to talk to NaCl if you don't have an nmf file embedded. This could be a handy new feature, but I wouldn't expect anything to be implemented any time soon. You'll probably have to use the ugly navigator.platform stuff or make a tiny nexe to solve your problem.
On Tuesday, December 18, 2012 2:26:33 PM UTC-8, David Michael wrote:Try reading navigator.platform.http://stackoverflow.com/questions/7044944/jquery-javascript-to-detect-os-without-a-plugin
Possible values in WebKit (most of which you can probably ignore) are here:
E.g., I get "Linux x86_64" locally.On Tue, Dec 18, 2012 at 12:17 PM, Bennet Yee (余仕斌) <b...@google.com> wrote:presumably you are thinking of packaged apps and not hosted apps. one way would be to include a set of tiny nexes that return their own arch in response to a postmessage from javascript. :-) but i suspect you want something even lighter weight. unfortunately i don't know of any javascript magic that'll do that; maybe somebody else has more clue?-bsy--On Tue, Dec 18, 2012 at 10:11 AM, Reed Riley <john.re...@gmail.com> wrote:
Is there any way to detect the NaCl architecture (32/64/ARM) that a client is going to use from within JavaScript?Specifically, I don't care at all what the actual architecture is, I just want to know which objects NaCl's going to load from the manifest.The application being downloaded is pretty large, so I'm caching it explicitly using the HTML5 Filesystem API - but I don't want to download content for unnecessary architectures.Thanks,Reedbennet s yee
i usually don't capitalize due to mild tendonitis