Skip to content

Instantly share code, notes, and snippets.

@andershaig
Created November 20, 2012 22:52
Show Gist options
  • Save andershaig/4121819 to your computer and use it in GitHub Desktop.
Save andershaig/4121819 to your computer and use it in GitHub Desktop.
Test Channel by Class
var channel;
if ($(body).hasClass('fbfanpage')) {
channel = 'fbfanpage';
} else if ($(body).hasClass('fbcanvas')) {
channel = 'fbcanvas';
} else if ($(body).hasClass('microsite')) {
channel = 'microsite';
} else if ($(body).hasClass('mobile')) {
channel = 'mobile';
} else {
channel = 'Unknown';
}
// Now you can use the variable "channel" for conditional JavaScript features
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment