Is there a way (in JavaScript) to detect between the following two scenarios?
- Device supports Flash, but Flash is not installed.
- Device does not support Flash (ie: iPad, iPhone)
I know how to detect if Flash is installed, and I know how to detect an iPad or iPhone specifically, but was wanting to find a way to generically detect if the device supports Flash at all, without using any kind of whitelist or blacklist.
You can detect if flash is installed or not. Adobe provides Javascript code for doing that.
You cannot detect if flash is supported (e.g. available), but not installed. Somewhat by definition, if flash is not installed, there is nothing on the device that would indicate anything about whether flash could be installed or not. You can see why this is so because a device might ship today without flash and without flash available and then flash might be made available later without any changes to the device itself. Thus, the device itself couldn’t possibly know that flash has been made available for it.
The only way to know if flash is available is to maintain your own giant device list. Since it’s constantly changing, you can’t even bake it into your javascript. You’d have to put it on a server and fetch info via ajax.
A shortcut (which it sounds like you’ve already thought about) is to detect if flash is installed and if not, see if the device is one of a few high volume devices (Android, iDevice, Windows Phone, Windows tablet, etc…) and use your pre-built knowledge of whether those devices have flash available or not. For the rest of the devices, you just wouldn’t know.