Chrome devtools extension to capture HAR - google-chrome

Trying to make an extension to capture and store chrome HAR.
Intent: extension has a popup html page with start and stop buttons. Capture all network requests of the current tab between clicking of start and stop button.
Problem: since chrome.devtools.* are only available to devtools_page, how am I supposed to send event (clicking of buttons) from popup page to the devtools page.
Read that the background page is responsible for communication between several parts of the extension. Not able to understand how that can be used here.

Related

Why chrome shows alert randomly when try to open custom protocol url with location.href?

i had took a look to another threads about chrome and custom protocol apps, but i couldn't resolve a doubt i've got. In my web app, when you click a button it fire a new tab with an webpage (window.open(url, "_blank")). The new tab is opened with the url (annother web app with https protocol). This url fire a javascript function on load that verifies some things and then generate a custom url, for example myurl://base64code, and put it in an existing iframe in this way windows.frames['myframe'].location.href=theCustomProtocolUrl. i tried in different ways (location.replace, create a new iframe and set the url, etc) and i always have the same problem. If i refresh (ctrl f5) the page it always show the dialog or if i open the link with the developer console opened. But if i click my button and the page is opened in a new tab it doesn't work only if i refresh (ctrl+f5). This works perfectly on IE11, it launch the app directly.
Any ideas why chrome, and edge, works like this?
UPDATE: I have found the reason, is i use the protocolcheck.js (https://gist.github.com/vladimirtsyupko/cfcd332476b16683bb0b) library.
First i tried to open a protocol with the timeoutHack (it use blur event) and then, after failing, it fires the other url (in this case https) and the dialog doensn't appear. I found a bug with blur event on chrome > 85 https://bugs.chromium.org/p/chromium/issues/detail?id=1137801
Thanks in advance

How do I completely load a pinned youtube tab in background on chrome startup?

Everytime I startup Chrome with Youtube pinned It doesn't load the youtube page completely until I make the tab active - i.e. I click on it. Interestingly tho it's status according to chrome.tabs.get() is 'complete'.
Here is an example
As you can see, the youtube wasn't loaded until I clicked on it's tab, while stackoverflows website didn't
have to do any loading.
Is there any way I can completely load youtube on chrome startup without explicitly making the tab active i.e. by clicking on it? I tried to execute reload on chrome window startup via chrome.tabs.reload(pinned_tab_id);, but it doesn't help.

Navigation back causes page reload in Chrome

I have a single page PHP application that fetches data from a third party API and outputs the items in a product grid. Clicking on one of the products leads to an external url which opens in the same window.
When using the back button in Chrome to go back på the application after clicking the external link, the page reloads for some reason. I'm only experiencing this problem in Chrome, therefore I'm wondering if it could be a Chrome related bug?
Found the issue. It was caused by using a window load event incorrectly.

How to toggle Device Mode on a popup window in Chrome?

I have a web app with a chat that opens in a new popup window. Normally, in Chrome I can hit F12 and click the icon of a smart phone to toggle it. But in the popup window this icon does not appear. This is important for me since I need to throttle the connection of the popup in order to simulate a user disconnecting from the chat.
Thanks!
It doesn't seem to be currently possible. I've opened a ticket for you. Meanwhile you have couple of options:
open popup in a regular window (copy paste the url, or modify window.open call to open a new tab instead of a separate window),
create a Chrome extension that uses debugger API to send emulateNetworkConditions message to your popup window
or try hacking DevTools like so:
open DevTools (A) for your popup
focus on DevTools window and open another DevTools (B) for that window using a keyboard shortcut (F12/alt+cmd+J)
in the console of the DevTools B call WebInspector.overridesSupport.setEmulationEnabled(true) (to enable emulation) and then WebInspector.overridesSupport.settings.networkConditions.set({throughput: 1.5 * 1024, latency: 40}); (to enable network throttling)
Perhaps easier way as of today is to install chrome extension which will allow you to open preview in new tab instead of popup. There you can have the same icon to toggle to mobile. Below is the extension:
https://chrome.google.com/webstore/detail/tag-assistant-companion/jmekfmbnaedfebfnmakmokmlfpblbfdm?hl=en

How to mute a tab in google chrome?

It is difficult to selectively mute the content that is making sound in google chrome. I have to locate the tab and then scroll up and down to find the content that is producing sound. It would be great if there exist a feature which will let me right click on the tab and say "Mute".
Is there any way to achieve this without using extensions?
Type this in Google Chrome's omnibox
chrome://flags/#enable-tab-audio-muting
You will see this listing
Enable tab audio muting UI control. Windows, Linux, Chrome OS
When enabled, the audio indicators in the tab strip double as tab audio mute controls. This also adds commands in the tab context menu for quickly muting multiple selected tabs. #enable-tab-audio-muting.
Click Enable link at the bottom of this. Restart Chrome to get this feature.
Note : This feature is supported in Google Chrome builds upwards of version 39
Reference: http://fieldguide.gizmodo.com/mute-noisy-tabs-in-google-chrome-1683215637