Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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 http://stackoverflow.com/a/4653175/117402
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
Something went wrong with that request. Please try again.