0

Can I display console.log messages on Iframe if yes can then please also tell me how to display it, I am creating a vary simple JS game and I want to display my logs on iframe.

Abhinav Singh
  • 27
  • 1
  • 11
  • i think you need to override console.log method to wirte on an iframe – bugwheels94 Jan 01 '16 at 07:41
  • 1
    What do you mean console logs on iframe? In my experience, console.logs in iframes show from the parent window, too. – itamar Jan 01 '16 at 07:42
  • Duplicate of http://stackoverflow.com/questions/9277780/can-i-extend-the-console-object-for-rerouting-the-logging-in-javascript ? – mplungjan Jan 01 '16 at 08:12

1 Answers1

0

You can try the following approaches:

  • change your logging so that you can target both console and some iframe. This has the advantage that you can have a separation between what is displayed on screen and what is logged, but you have to work more

  • override console.log, so that you can also do something else with output data

Community
  • 1
  • 1
Alexei - check Codidact
  • 17,850
  • 12
  • 118
  • 126