Reputation: 3548
If I create a bunch of functions in a chrome extension, is there anyway to access them through the console?
for example:
contentScript.js
function test() {
console.log('hello')
}
then be able to run test()
in the console
Upvotes: 5
Views: 2985
Reputation: 73865
The content scripts run in an "isolated world" which is a different context. By default devtools works in the page context so you need to switch the context selector in devtools console toolbar to your extension:
An alternative solution is to expose the functions in the page context by putting them into a <script>
element in the web page, but that won't be your content script anymore, it'd be just a normal page script function (more info).
Upvotes: 7
Reputation: 24
You can access your extension's console by right click on the extension popup and then selecting "Inspect".
Upvotes: -1