Skip to content

Instantly share code, notes, and snippets.

@livingston
Forked from kangax/gist:381634
Created April 28, 2010 12:49
Show Gist options
  • Save livingston/382098 to your computer and use it in GitHub Desktop.
Save livingston/382098 to your computer and use it in GitHub Desktop.
Optimized Script for loading User Voice Script
/* Optimized Script for loading User Voice Script
* Based on idea by kangax @ http://gist.github.com/381634
*/
var uservoiceOptions = {
/* ... */
};
//Using `self` rather than `window` to prevent cross-domain issues when used in iframe
self.onload = (function (w, d, t) {
var _loadUserVoice = function () {
var s = d.getElementsByTagName(t)[0],
UV = d.createElement(t);
UV.async = !0;
UV.src = '//cdn.uservoice.com/javascripts/widgets/tab.js';
s.parentNode.insertBefore(UV, s);
}, original = w.onload;
if(typeof original === 'function') {
return function () {
original();
_loadUserVoice();
};
}
return _loadUserVoice;
}(self, document, 'script'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment