Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'console-restore' snippet #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions snippets/console-restore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### console-restore.js

A simple way to restore console's functionality after its functions were overwritten with noop functions.

[![console.restore](console-restore.png)](console-restore.js)
15 changes: 15 additions & 0 deletions snippets/console-restore/console-restore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// console-restore.js
// Restore console's functionality

(function(document, window){

// jQuery version: window.console = jQuery('<iframe>').hide().appendTo('body')[0].contentWindow.console;

var iframe = document.createElement('iframe');
iframe.style.display = 'none';
iframe.src = 'about: blank';

document.body.appendChild(iframe);
window.console = iframe.contentWindow.console;

})(document, window)
Binary file added snippets/console-restore/console-restore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.