Go to Twitter\'s login page and type the following in the console:
window.addEventListener(\'keypress\', function(e){console.log(\'hello\')}, true)
Get it from an iframe:
function setConsole() {
var iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
console = iframe.contentWindow.console;
window.console = console;
}
(and then call it)
setConsole()
source: https://gist.github.com/cowlicks/a3bc662b38c36483b35f74b2b54e37c0