Skip to content

Instantly share code, notes, and snippets.

@adunkman adunkman/README
Created Apr 12, 2012

What would you like to do?
Detect ClickOnce support
This detects the presence of ClickOnce in IE, Chrome (with extension), and
Firefox (with extension).
It doesn't work if Firefox is using Microsoft's .NET Framework Assistant when
adding .NET information to the User Agent string is turned off (the default
setting as of late). I personally worked around this by using server logic to
detect if the X-ClickOnceSupport header was set.
(function () {
// Detect if ClickOnce is supported by the browser.
// Roughly based on
var hasMimeSupport = function (desiredMime) {
var mimes = window.navigator.mimeTypes,
hasSupport = false;
for (var i = 0; i < mimes.length; i++) {
var mime = mimes[i];
if (mime.type == desiredMime) {
hasSupport = true;
return hasSupport;
var sniffForClickOnce = function () {
var userAgent = window.navigator.userAgent.toUpperCase(),
hasNativeDotNet = userAgent.indexOf('.NET CLR 3.5') >= 0;
return hasNativeDotNet || hasMimeSupport("application/x-ms-application");
window.clickOnce = sniffForClickOnce();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.