Through your browser, you can't. If you access your website through an Android app, you can do the following:
- Check if device has unknown sources enabled:
boolean isNonPlayAppAllowed = Settings.Secure.getInt(getContentResolver(), Settings.Secure.INSTALL_NON_MARKET_APPS) == 1;
(Source: https://stackoverflow.com/a/16675266/3673616)
- Send the boolean as a get parameter. For example:
http://yoursite.com/somefile.apk/?unknown=true
- Depending on your parameter, decide what the server is going to do.
This is the only way I can think of - however, it is definitely not possible simply through the browser.