External javascript hijacks console.log

I noticed a strange behavior whereby my `console.log` statements weren't doing anything. I finally tracked this to an external script: Unfortunately this script is used to run the only heatmap package for google charts (AFAIK). Is there a way to somehow backup `console.log` and then restore it after executing their code? I tried doing a shallow backup but had no luck: Now I'm asking someone who knows what he's doing. Thanks in advance for your help.
Where is your attempt of the "shallow backup but had no luck"? I'm sure there's an easier way of this, but you could do: var logger = console.log.bind(console); before the bad part, then use console.log = logger; to restore it maybe?

以上就是External javascript hijacks console.log的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准