Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save interactiveRob/df432ade87ead523c33425bb89b962f3 to your computer and use it in GitHub Desktop.
Save interactiveRob/df432ade87ead523c33425bb89b962f3 to your computer and use it in GitHub Desktop.
Simple pardot detect iframe add class to body
<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