Forked from interactiveRob/detect-pardot-editor-simple.html
Created
December 10, 2020 15:43
-
-
Save zagriyen/4a57850b169c5a3994dc0e8961186346 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