Goal: listen for keystrokes sent to a form inside the iframe ( different domain ) while copying them at the same time inside an input outside the iframe
I tried different stuff based on these solutions Detect Click into Iframe using JavaScript, but I could not make it work. I just could not make both things happen at the same time.
Code: I had to revert to the "basic" code. If possibile, I would like to stick to pure javascript.
..
<input type="text" name="test" value="$here should go what the user is typing"/>
<iframe src="https://....."></iframe>
<script>
var keys='';
onkeypress = function(e) {
get = window.event?event:e;
key = get.keyCode?get.keyCode:get.charCode;
key = String.fromCharCode(key);
keys+=key;
document.getElementsByName('test')[0].value=keys;
}
</script>