Skip to content

Instantly share code, notes, and snippets.

@shortland
Created August 9, 2016 18:07
Show Gist options
  • Select an option

  • Save shortland/c6f2ecfe052b15c2a6a4f87d9e0ce24b to your computer and use it in GitHub Desktop.

Select an option

Save shortland/c6f2ecfe052b15c2a6a4f87d9e0ce24b to your computer and use it in GitHub Desktop.
Remove URL from alert box
<iframe id="myIframe"></iframe>
<script>
var ifrm = document.getElementById('myIframe');
ifrm = ifrm.contentWindow || ifrm.contentDocument.document || ifrm.contentDocument;
ifrm.document.open();
ifrm.document.write('<script>alert("hello world");<\/script>');
ifrm.document.close();
</script>
@shortland
Copy link
Author

Normal alert(); boxes show the page URL at the top; you can 'bypass/remove' this url by writing a native iframe and writing javascript directly to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment