I am working on Google Extension where I am adding new panel to the developer tools and it seems to be working fine for me. But I don’t know how to modify the content of the panel through JavaScript.
Could anyone enlighten me?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Displaying content in a panel is not that hard. First, I assume that you’ve created the base extension (consisting of
manifest.json,devtools.htmlanddevtools.js) following the documentation.devtools.htmlcontains at least<script src="/devtools.js"></script>.When
chrome.devtools.panel.createis used to create a panel, a callback can be specified. This callback receives an argument of the typeExtensionPanel. This object defines theonShownandonHiddenevent listeners.The
onShownevent listener receives an additional argument: A reference to the panel’swindowobject. Now, you can do anything you wish.For example, append some text to the panel, when the user opens the devtools panel for the first time: