Improved javascript console handling