Created
January 12, 2021 07:23
-
-
Save tieutantan/ec2ff4bd0a00b3e779fb7841dbc14f92 to your computer and use it in GitHub Desktop.
JS alert without URL on the top of modal
This file contains 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
function silentAlert(messages) { | |
let iframeElement = '<iframe style="display: none;" id="silent_alert"></iframe>'; | |
document.getElementsByTagName('body')[0].innerHTML += iframeElement; | |
let ifrm = document.getElementById('silent_alert'); | |
ifrm = ifrm.contentWindow || ifrm.contentDocument.document || ifrm.contentDocument; | |
ifrm.document.open(); | |
ifrm.document.write('<script>alert("' + messages + '");<\/script>'); | |
ifrm.document.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment