Most modern browsers can display the network traffic of the currently open webpage and its dependencies in its dev tools.
When the browser sends the initial HTTP request for a webpage, it uses the response to display the webpage. A javascript file that the webpage depends on may send another request through AJAX.
Does the browser monitor the execution of the javascript file and display the subsequent requests in the original page's network log?
EDIT: For a bit of background, I'm trying to write a python program that will display all the network traffic generated by a webpage and its dependancies.
if you use chrome browser, you can use network feature on Developer tools.
through this feature, you can monitor all of network activities on page.
for monitoring execution of javascript, search firebug on google.
How do web browsers monitor network of current open webpage?
The short answer: the browser knows about all this, because it has to prepare and send/receive all requests to the webserver. That's his job, and involves much more than monitoring only.
Does the browser monitor the execution of the javascript file and
display the subsequent requests in the original page's network log?
The browser not only has to monitor the execution of the script, it has to execute the script itself. The script then forwards the subsequent request to that same browser, thus no need for the browser to monitor the script to get that information.
For a bit of background, I'm trying to write a python program that
will display all the network traffic generated by a webpage and its
dependancies.
Since this seems to be for educational purposes, you might want to start with writing a plugin for the browser to get an idea of what's happening inside (this will be mostly in JavaScript). In your plugin you can make direct API-calls to the browser-engine, or use call-backs to get notified when requests are made or pages/images arrive.
To monitor that traffic from within a stand-alone application, more work needs to be done. You'll have to sit somewhere in between the browser and your network card. This can be done by:
Writing some kind of proxy to catch and forward the HTTP-traffic and direct your browser to that proxy.
Using a library such as libpcap to catch all network traffic and analyzing the TCP-packets.
Related
I'm using Chrome in headless mode via CDP (Chrome devtools protocol) to do HTML to PDF conversions. Works well but I do not trust Chrome to run forever and want to build a guardian service to monitor its responsiveness and if necessary kill the process and relaunch it.
What would be a good indicator of health? What I'm looking for is a low overhead test I can perform at fairly frequent intervals so that the restart latency is minimised.
I could try to perform some kind of CDP command if anyone has a suggestion and a reliable way to determine success.
I can't think of anything else, that's why I've thrown it open for suggestions.
My best suggestion for this case is to use the Target domain. Listening to some of the events that are fired from the target domain will give you some information regarding the state of your browser, such as TargetCrashed.
On top of that, you could use basic domains like Runtime (provides the evaluate method), SystemInfo or Browser to send the browser requests in order to check its health.
With an increasing mobile user base I would like to be able to gauge a baseline for site performance. Typically I can do this using chrome dev tools, checking when DOMContentLoaded finishes, and checking all my javascript tags to make sure they're in acceptable threshholds. How would I go about automating this so I can create performance dashboards?
Maybe phantomjs, selenium can do this? What headless chrome implementation could I use to achieve this.
You can use Lighthouse to capture a variety of performance metrics.
For real user metrics, you can instrument your app however you see fit with the User Timing API.
I tried Dev tools in Chrome but it is not showing at all.
I am trying to monitor a Chart/Graph App that is getting live Data. Some External monitoring tool is the last resort but I was hoping to use FF/Chrome for the purpose, if possible.
Thanks
Whenever I send a GET-request to my webapp using chrome, according to my apache access log two identical requests (not always, but most of the times, I can't reproduce it - it's not for the favicon) get send to the sever, although only one is shown in the chrome dev tools. I deactivated all extensions and it's still happening.
Is this https://news.ycombinator.com/item?id=1872177 true and is it a chrome feature or should I dig deeper within my app to find the bug?
I think it's even worse than that. My experience here (developing with Google App Engine), is that Chrome is making all kinds of extra requests.
This is possibly due to the option that is in the Settings, checked by default:
Predict network actions to improve page load performance
Here is a really weird example: my website's page runs a notifications check every 15 seconds (done in javascript). Even after closing all tabs related to my website, I see requests coming from my IP, some random pages but also the notification check request. To me that means that Chrome has a page of my website running in the background and is even evaluating its javascript.
When I request a page, I pretty much always get another request for one of the links in that page. And it also requests resources of the extra pages (.css, .js, .png files). Lots of requests going on.
I have seen the same behavior with the development server that runs locally.
Happens also from another computer / network.
Doesn't happen with Firefox.
Also, see What to do with chrome sending extra requests?
I need to reverse-engineer some javascript application which does authorization using facebook auth.
Facebook auth window pops up, asks for my permissions, and gets closed instantly, so I am unable to grasp anything from the performed action, as it's too fast.
The problem is that neither Chrome DevTools, nor Firefox Firebug does display network activity for child windows like OAuth permission.
Is there a way to enable FULL network log? An extension, whatever? (It better be free and easy to use)
If you're using Windows, you need Fiddler. If you're not, you'll have to settle for Wireshark. Wireshark is more-general and an amazing tool, but Fiddler does a much better job for HTTP and SSL conversations like you're going to be examining.