Created
May 29, 2020 15:54
-
-
Save interactiveRob/df432ade87ead523c33425bb89b962f3 to your computer and use it in GitHub Desktop.
Simple pardot detect iframe add class to body
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
<script type="text/javascript"> | |
document.addEventListener('DOMContentLoaded', function () { | |
function isIframe() { | |
try { | |
return window.self !== window.top; | |
} catch (e) { | |
return true; | |
} | |
} | |
if (isIframe()) { | |
document.body.classList.add('is-pardot-editor'); | |
} | |
}); | |
</script> | |
<style> | |
body.is-pardot-editor{ | |
/*--add CSS here ---*/ | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment