Skip to content

Instantly share code, notes, and snippets.

@wickdninja
Created July 25, 2018 00:50
Show Gist options
  • Save wickdninja/234370f4d729f4debac514eaf6e51f10 to your computer and use it in GitHub Desktop.
Save wickdninja/234370f4d729f4debac514eaf6e51f10 to your computer and use it in GitHub Desktop.
var IFrameClassAppender = (function (window, $, self, undefined) {
// ReSharper disable once InconsistentNaming
var isFrame, body, ua, iOS, iOS8;
self.init = function () {
isFrame = (window.top !== window.self);
if (isFrame) {
body = $('body');
body.addClass('iframe');
ua = navigator.userAgent.toLowerCase();
iOS = /(iphone|ipod|ipad)/.test(ua);
iOS8 = /(iphone|ipod|ipad).* os 8_/.test(ua);
if (iOS && !iOS8) {
body.addClass('legacyApple');
}
}
};
self.isFrame = isFrame;
return self;
}(window, jQuery, IFrameClassAppender || {}));
$(document).ready(function() {
IFrameClassAppender.init();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment