Is it possible to modify the Chrome or Firefox developer tools network page? - google-chrome

Both Chrome and Firefox provide "Network" pages in their DevTools, which are very useful. I'm working with software which adds headers to HTTP responses to communicate performance information. I would like to be able to see this information at-a-glance in the Network panel, but looking at the relevant Chrome and MDN docs, I can't see any way to modify existing DevTools panels.
Is it possible to do this? If so, how?

Both Google Chrome and Firefox allow you to modify the shown columns and to show specific header values. It seems however that only in Chrome you can also add custom headers.
To do so, open the Network tab in the Dev Tools and make sure there is at least one entry in the list. Then right click on one of the table headers (like Name, Path, Method, etc.) to open the context menu that allows you to select which columns you want to show. From this context menu go to "Response Headers" -> "Manage Header Columns...". Then in the modal that pops up click "Add custom header..." and enter the name of the header you want to show. Click "Add" and it should now be part of the overview table.
In Firefox it works the same, but you can only select one of the predefined headers.

Related

How to access Gmail messages selected (checkbox)

I am trying to build an Add-On for gmail which will perform some actions on a set of messages selected by the user.
Looking at the gmail Apps Script API, I cannot see a method that allows me to do that.
I've noticed that some AddOns operate on selected messages, just like what I want to do. See picture below...
The checkboxes (highlighted in green) tell the AddOn what to operate on.
What am I missing?
The opened menu has options to forward the messages selected by combining them.
Also, I noticed that this AddOn is placed by google along the top. The same happen to the boomerange AddOn. The AddOn I am developing, always appears on the right hand side (pink arrows).
How can you place your addOn along the top menu?
The items you reference with the orange arrows in the image are not Gmail Add-ons, they are actually Chrome Extensions. Chrome Extensions are installed in the browser and they can add functionality by manipulating the DOM (Document Object Model) of a webpage. The chrome extension in question is probably specifically targeting chrome tabs with Gmail loaded and injecting content in the respective pages.
If you want to learn more about developing Chrome Extensions check out the following documentation:
https://developer.chrome.com/extensions/devguide
And for developing gmail specific Chrome Extensions you might want to check out the InboxSDK framework linked below:
https://www.inboxsdk.com/

Is it possible to open multiple instances or split view of chrome developer tools tabs?

I want to debug code at the same time as I see what is being sent on the network tab without having to go back and forth between the Network tab and Sources tab. Is there a way to do this as of chrome Version 52.0.2743.82 or Version 54.0.2810.2 canary?
I know that it is possible to log http request in the console which can be visible with other tabs open but I want the actuall networks tab if possible..
Thank you in advance
This is now possible in Chrome 87. Right click Network in the menu and select "Move to bottom"
and it will do this
You can view 'Quick source' while viewing the Network panel (or the other main panels) at the same. This will allow you to view the source and add breakpoints.
However, it's not possible to step through code using the debugging in the split view. Chrome will automatically switch to the Sources tab if you use the shortcuts.
It's also not possible to have an extension running a separate instance of the debugger as the Chrome Debugging Protocol doesn't allow simultaneous clients to be connected.
I will open up a discussion with other Chromium contributors into the feasibility of sharing the debugging controls in the split view. I don't know whether it will or can be done easily. I suspect it's a fair amount of work.
If you would like to set up the split view, as it's useful anyway, go to overflow menu on the right side and select 'More Tools' and then select 'Show console'. This makes sure the panel loads below the main one.
On the left side of the panel that shows, click the overflow menu and select 'Quick source'.
You will now see a small Sources panel.
Since I was referred here from this question, I'll answer here.
In my scenario I need to be able to work on two different source files (under DevTools->Sources) simultaneously, for instance an html and a css file.
My workaround was to work on two separate tabs.
Right click one of them and click 'Open in new tab'.
When the new tab is open press F12 to open DevTools, and dock the two editors side by side (Focus on one and pressing ⊞+→ then leftwards on the other one).
Result:

Google Chrome Extension Top Sites Images

So using the Google Chrome Top Sites api has values for the url and the title, but when you load the default google chrome page it also has an image of those sites, is there any way to get that sort of image for an extension? If not how does google get that image and how can you get an image of the the user's top viewed website?
Since that it isn't possible to get a screenshot of a page without loading it inside a tab, Chrome is simply getting those screenshots while you're browsing your favourite sites. You can tell this easily because sometimes sites and images do not coincide (e.g. sometimes my facebook.com top site has the image of my profile page, but links to the home).
Then, if you want your screenshots of the Top Sites, you'll have to start without screenshots, and create them while the user browses the web by using the chrome.tabs API to check when a tab loads one of the Top Sites (listening to the event onUpdated), and get a screenshot of that tab using captureVisibleTab.
NOTES: make sure that you've requested the permission for "<all_urls>" in your manifest, which is required for captureVisibleTab to work. Additionally, you may find this question and its answer helpful.
It's unfortunately not possible*. Chrome stores those thumbnails internally in URIs not accessible from an extension.
There is an existing feature request: https://code.google.com/p/chromium/issues/detail?id=11854
If you look at the comments, one of the main use cases is to access site thumbnails to replicate the New Tab page.
Do star the feature request above to raise its priority if you want this functionality implemented.
* By that I mean that it's not possilbe to access Chrome's own internal store of thumbnails.
Furthermore, as Marco suggested the way to replicate that would be tab capture, but you can't do it "in the background" for privacy reasons - a user must make an explicit gesture (e.g. click the extension's button, press a shortcut, etc.) to perform capture.
Marco's answer is valid now, captureVisibleTab should be accessible upon events. But yes, as of now Chrome forces you to have very broad permissions and maintaining your own thumbnail store.

How to block a URL in Chrome's developer tools network monitor

I am currently analysing my page connections and I want to block some tracking scripts and other external URL calls in my network monitor inside Chrome's developer tools.
I quickly want to check how the page behaves without some libraries.
Chrome itself does not provide any functions like this and the famous blocking extensions only block URLs which the user enters manually into the navigation bar.
As pointed out by #calavera.info, #iman.Bahrampour, and #Asim K T this feature is now available in Chrome 59. You can select a URL or domain to block in the Network panel. See this release note and these Screenshots where the StackOverflow logo has been blocked from this page. #iman.Bahrampour also shares two extensions below that will also do this ("HTTP Request Blocker" and "Request Blocker").
As abd3721 mentioned this is available directly within chrome DevTools (You don't need to be on canary anymore), however it is still behind a flag and in the hidden experimental features menu. As of the time of this comment, Chrome stable is on version 53.
To enable it, open this link and click the enable link under the appropriate flag:
chrome://flags/#enable-devtools-experiments
Then in DevTools open up the settings panel(F1) and click on the experiments tab.
This lists all currently available DevTools experiments but it is still in yet another hidden set of features.
Press Shift 6 times while in the experiments tab to show even more hidden features, one of them will be Request Blocking.
NOTE: These features are considered experimental and may be buggy or incomplete. Use with caution.
For blocking requests in google chrome you have 3 options:
1. Google Chrome with pattern matching:
In network tab, right click on request and then select block request URL
There is a plus sign that adds patterns for blocking requests
For example I have 7 request URLs:
http://www.test.com?userid=5
http://www.test.com?username=username
http://www.test.com?email=email
http://www.test.com?name=x
http://www.test.com?family=q
http://www.test.com?family=y
http://www.test.com?family=z
I can block requests that have a specific pattern by adding a pattern(for example the pattern *family* blocks 3 below requests):
http://www.test.com?family=q
http://www.test.com?family=y
http://www.test.com?family=z
Be careful! Because patterns are case sensitive
2. HTTP Request Blocker extension:
This extension has pattern matching for blocking requests:
Match patterns
3. Request blocker extension:
This is a useful extension that has pattern matching for blocking requests.
The most useful features of this request blocker are importing and exporting lists for using by other People.
For exporting a list and using in another computer(or future used): click on Direction down and select Export.
Open the exported list with import list button.
Good Luck
From Chrome 59 you can block specific requests from Network tab of developer tools itself.
https://developers.google.com/web/updates/2017/04/devtools-release-notes#block-requests
Right-click on the request in the Network panel and select Block Request URL. A new Request blocking tab pops up in the Drawer, which lets you manage blocked requests.
This is now achievable in Chrome 59 developer tools by blocking respective requests: https://developers.google.com/web/updates/2017/04/devtools-release-notes#block-requests. With this approach it is somehow difficult to turn off all the stylesheets, but it's easier to turn off just the most annoying ones.
As for Google Chrome 94, it's possible to exclude network activity for entire domain:
1. Go to "Network" panel of DevTools:
2. Rigth click on item of domain you want to block, click on "Block request domain" in the context menu:
3. Type "status-code:0" into "Filter" and click on "Invert" checkbox:
To manage blocked domains, press ESC button when in DevTools, and click on "Network request blocking" tab in the bottom panel:
Will changing host file help.
Your system (windows, linux, mac) all check host before requesting DNS lookup. I use it when I wan tot block some slow advertisers.
windows:
c:\Windows\system32\drivers\etc\hosts
linux & mac
/etc/hosts
* BE VERY CAREFUL TO MAKE BACK UPS *
An existing bug report is requesting this feature. You can star that issue to show support for it being added.
Well, i have been looking for an answer for this too, as I had this issue of choices by counterfeit, and nothing seemed to work for me.
But then I tried to analyze the requests and other things until I figured out, that there was this site which was loading ads onto my pages and redirecting me to advertisements. And also changing the google search bar on new tabs to some unknown search engine. I was able to temporarily block the request on one page. but after opening a new tab, the ads would appear again.
So googling for request blocker, I came up with a chrome extension "HTTP Request Blocker" and added the address which was causing all the crazy ads, has now solved the problem fully.
I hope it will be of help to you too or anyone else.
In the original question, the author states:
the famous blocking extensions only block URLs which the user enters manually into the navigation bar.
This is no longer the case. I have really enjoyed using mokku, which can intercept and mock all types of requests. You can specify what the status code should be, so it will definitely solve this problem as well as adding other functionality that is helpful. It works by another tab in the chrome dev tools. Here is a link to the extension: https://chrome.google.com/webstore/detail/mokku-mock-api-calls-seam/llflfcikklhgamfmnjkgpdadpmdplmji?hl=en

How can I display the same DOM across several tabs in a Chrome Extension?

I'm looking to build a chrome extension that allows the user to have an independent subwindow that is the same in each tab (for example you are taking notes and the notes are synchronized among each tab). Also, clicking a link should not destroy this subwindow.
One solution is to inject an iframe in each tab, and try to synchronize this data serverside and send back to each client tab, as it is updated.
This seems very tedious, plus the iframe would be provided by a third party, and I want to make it the easiest for them.
Is there a way I can have a shared dom piece and display it in its current state across several tabs?
There's an API (still experimental as of Chrome 17) that does more or less exactly what you want. If you visit about:flags, and enable "Panels" (they're enabled by default in Dev and on Canary (and on ChromeOS)), you'll be able to use chrome.windows.create with a type of panel to create a floating pane that exists independently from the browser window. That would likely meet your need.
Take a look at the Google Talk extension for an example of how it might work.