Created
April 8, 2012 02:41
-
-
Save dtinth/2334039 to your computer and use it in GitHub Desktop.
sets the dock badge in Fluid, with resistant to back buttons.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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