Reputation: 1876
I'm using chrome devtools network API and the following code but always the alert window is launch when I opened the devtool windows (F12). Is there any way to launch the alert just without open that window, for example, when the page load?
background
chrome.experimental.devtools.network.getHAR(
function(result) {
alert(result);
});
Upvotes: 2
Views: 1262
Reputation: 5143
If the web inspector isn't open, the devtools APIs are non-functional. This is the same reason that, for example, network events don't show up in the web inspector if it isn't open when you initially load the page.
You are able, however, to use the WebRequest APIs from extensions regardless of the web inspector's state. That won't give you HAR formatted data, but it does give you access to every request generated for a page. That might be a reasonable option for you, depending on what information you're looking for.
Upvotes: 7
Reputation: 4912
I don't know so much on developing for the dev tools, but I think that the dev tools API "doesn't exists" until you open the dev tools, so the code won't and can't be executed without opening it
Upvotes: 2