Skip to content

Instantly share code, notes, and snippets.

@danielt69
Created May 10, 2019 09:16
Show Gist options
  • Save danielt69/00ebc2dfb1344f56a42b6f28f2d14ec5 to your computer and use it in GitHub Desktop.
Save danielt69/00ebc2dfb1344f56a42b6f28f2d14ec5 to your computer and use it in GitHub Desktop.
hide wp admin bar in iframe
window.addEventListener('DOMContentLoaded', (event) => {
if (window != top) {
document.getElementsByTagName("html")[0].setAttribute('style', "margin-top: 0 !important");
document.getElementById("wpadminbar").remove();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment