John Hoffman
John Hoffman

Reputation: 18607

Why no logs in the console for Chrome devtools extension?

I'm making a Chrome devtools extension. I make a simple devtools page:

<!DOCTYPE html>
<html>
<body>
  Foobar. <script>console.log('foobar');</script>
</body>
</html>

I specify "devtools_page": "dev-tools.html" in manifest.json. However, nothing prints in the console. Why is that?

Upvotes: 0

Views: 164

Answers (1)

Haibara Ai
Haibara Ai

Reputation: 10897

  1. By default, inline script won't be executed. You could extract the scripts to a external js file and include that using <script></script>

  2. Detach the F12 tool and press Ctrl+Shift+J(Windows) to view your console (shortcuts here). More details you can find from this answer: Chrome devtools extension console

Upvotes: 2

Related Questions