Skip to content

Instantly share code, notes, and snippets.

@dtinth
Created April 8, 2012 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtinth/2334039 to your computer and use it in GitHub Desktop.
Save dtinth/2334039 to your computer and use it in GitHub Desktop.
sets the dock badge in Fluid, with resistant to back buttons.
var fluidHoster = window;
var fluidIframe = null;
var fluidQueuedText = null;
function setDockBadge(text) {
if ('fluid' in window) {
try {
if (fluidHoster == null) {
fluidQueuedText = text;
} else {
fluidHoster.fluid.dockBadge = text;
}
} catch (e) {
fluidHoster = null;
fluidQueuedText = text;
if (fluidIframe != null && fluidIframe.parentNode) {
fluidIframe.parentNode.removeChild(fluidIframe);
}
var iframe = fluidIframe = document.createElement('iframe');
iframe.onload = function() {
fluidHoster = iframe.contentWindow;
fluidHoster.fluid.dockBadge = fluidQueuedText;
};
iframe.src = 'about:blank';
iframe.style.display = 'none';
document.body.appendChild(iframe);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment