11

I have a Silverlight application I built back in 2009. Unfortunately, Silverlight is not available for 64-bit browsers. And the usage of 64-bit browsers is just starting to grow, especially with the release of Windows 8. So I want to detect the 64-bit browser and provide a user friendly message stating why the application was unable to load.

I could feasibly pull this off with a bit of Javascript, but the user-agents and such seem to be all over the map. And I've tried navigator.cpuClass which seems to do what I want in Internet Explorer. It returns x86 on a 32-bit version of IE10. But it returns undefined in Chrome and Firefox. So I'm looking for a reliable solution for all browsers.

Note that I don't care if the OS is 64-bit or not. That doesn't matter. I'm only concerned about the browser.

Steve Wortham
  • 21,740
  • 5
  • 68
  • 90
  • http://stackoverflow.com/questions/1741933/detect-64-bit-or-32-bit-windows-from-user-agent-or-javascript – luk2302 Jun 27 '13 at 19:01
  • @lik2302 That shows the OS bits, not the browser bits. – Surreal Dreams Jun 27 '13 at 19:02
  • so you are reffering to the edge case when the browser is 32-bit and the system 64-bit? – luk2302 Jun 27 '13 at 19:04
  • I haven't used plugins for a long time, but was it not always possible to display a fallback `html` inside of the `object`/`embed` element, like you can do with `noscript` if `js` is not active? – t.niese Jun 27 '13 at 19:05
  • 9
    Instead of detecting the OS/browser, why not just detect the presence or lack of the actual silverlight plugin? Something like http://stackoverflow.com/questions/119980/detect-via-javascript-whether-silverlight-is-installed – faffaffaff Jun 27 '13 at 19:08
  • 3
    How do you want to handel this situation: Silverlight is not installed but browser is 32-bit ? – t.niese Jun 27 '13 at 19:12
  • @faffaffaff - That's not good enough. A user could have Silverlight installed (and it works on all of their 32-bit browsers they have installed). But if the user is using a 64-bit browser, it's not accurate to say that it's not installed. – Steve Wortham Jun 27 '13 at 19:12
  • @luk2302 - That's for the OS, not the browser. It's a different question. – Steve Wortham Jun 27 '13 at 19:18
  • @t.niese - Not sure what you're asking. Here's the thing. 90% of the time the users at my site will be using 32-bit browsers which Silverlight can handle. However, if a user comes along with a 64-bit browser they're presented with an unpleasant "Install Silverlight" user experience where they'll be directed to Microsoft's site only to be told that Silverlight doesn't work on 64-bit browsers. I want to bypass all of that and do the detection of a 64-bit browser myself. – Steve Wortham Jun 27 '13 at 19:21
  • @t.niese - Oh, right now I get it. Yeah, that situation is already handled. They're simply instructed to install Silverlight if they're on a 32-bit browser but don't have Silverlight installed yet. – Steve Wortham Jun 27 '13 at 19:23
  • 2
    Please reopen. The question marked as a duplicate is not a duplicate. – Steve Wortham Jun 27 '13 at 19:25
  • 1
    @SteveWortham check this [answer](http://stackoverflow.com/a/6267019/1960455) of the mentioned question. Looks like the `window.navigator.platform` reflects if browser runs as `32` or `64` bit, so probably the question (even if not a duplicate) is still helpful. – t.niese Jun 27 '13 at 19:38
  • @SteveWortham I have to agree with t.neise. The answer to this question appears to be in that answer. If that answer isn't correct, say so and I'll cast a repoen vote. EDIT: repeon vote? Zug Zug! I mean't a re-open vote :) – corsiKa Jun 27 '13 at 19:49
  • @corsiKa - That answer doesn't really answer my question any better than I already have. I already knew that the `navigator.cpuClass` was effective in giving me what I needed for IE. Their examples don't really help for the other browsers though. I have a feeling that to solve this problem will require a lot of testing and looking at more than just the `navigator.platform` and `navigator.cpuClass` variables. – Steve Wortham Jun 27 '13 at 19:58
  • 1
    Umm, Silverlight 5 works fine on 64-bit browsers! IE 9: http://i.imgur.com/fccYxu1.png and [Pale Moon](http://www.palemoon.org/palemoon-x64.shtml) (64-bit Firefox): http://i.imgur.com/9jOGaIK.png This is on Windows 7 SP1. I'd assume it does on Windows 8, but I could be wrong. – gen_Eric Jun 27 '13 at 20:01
  • @RocketHazmat - Interesting. I'm still trying to figure out why. Is it possible that the rendering engine in these 64-bit browsers are actually running in 32-bit? It obviously throws a wrinkle into this. But if you open IE10 from Windows 8 you'll get this message, "Microsoft Silverlight cannot be used in browsers running in 64 bit mode." at http://www.microsoft.com/getsilverlight/get-started/install/default.aspx?reason=64bit – Steve Wortham Jun 27 '13 at 20:11
  • @SteveWortham: Are you using the desktop version of IE 10 or the metro one? I don't think the metro one supports plugins. They are 2 completely separate browsers. On the "System Requirements" tab on that page, it says "Windows 8 Desktop" supports 64-bit in IE 10. – gen_Eric Jun 27 '13 at 20:15
  • @SteveWortham: I think MS is lying. http://i.imgur.com/m15dB6m.png (p.s. the `*` in the table means "supports 64-bit mode") – gen_Eric Jun 27 '13 at 20:17
  • 1
    @RocketHazmat - I'm using the metro one. But I just found where it says 64-bit browser support is new to Silverlight 5... http://msdn.microsoft.com/en-us/library/gg986857(v=vs.95).aspx My app is in Silverlight 4, so it would appear that upgrading my app to Silverlight 5 would be one way to solve this. – Steve Wortham Jun 27 '13 at 20:19
  • 1
    @SteveWortham: Didn't realize Silverlight 4 didn't support 64-bit. Upgrading is one solution. :-) – gen_Eric Jun 27 '13 at 20:20

1 Answers1

4

Thanks to @RocketHazmat, I uncovered that 64-bit browser support was introduced with Silverlight 5. My app was using Silverlight 4. So I upgraded to 5 and now it works with the 64-bit browsers I've tested.

However, there's still one exception. Even Silverlight 5 won't run in the metro version of IE10 under Windows 8. Apparently this is by design as this is a specialized version of IE10 optimized for touch. That still doesn't explain it for me though. I think it's lame.

Of course this means that 64-bit browser detection isn't really a concern anymore. Microsoft just needs to add Silverlight support to this browser and then I'll be happy.

UPDATE

I found an interesting tidbit related to the metro/modern IE10 in Win8. You can instruct the browser that there are plugins on the page that require the "desktop" version of IE.

You just need to add this meta tag to your HTML...

<meta http-equiv="X-UA-Compatible" content="requiresActiveX=true" />

And that'll generate this prompt...

enter image description here

Community
  • 1
  • 1
Steve Wortham
  • 21,740
  • 5
  • 68
  • 90