Stop browser from requesting service-worker.js from server - google-chrome

On a former project I was working on there was a manifest.json file while allowed the app to be a progressive web application.
However even now on different projects I can see that my browser is requesting the service-worker.js file from the backend ie:
GET /service-worker.js 404 557.926 ms
How can I turn this off within my browser so I don't see these errant logs come through my app?

You need to unregister the service worker like such:
https://www.codementor.io/#himank/how-to-unregister-service-workers-n8mzf5jce
In case the link should stop working, these are the steps for Chrome.
open the dev console
click "Application" tab
click "Service Workers"
click "Unregister"

Related

Capture Downloads in the Network Tab of Google Chrome Developer Tools

The Network tab in the Google Chrome Developer Tools window shows almost all http requests made, but does not seem to capture anything when the http request results in a file being downloaded.
How can I capture download requests in Google Chrome?
I am sure that your file download is happening by opening a new window. Network tab of developer tools only captures the request of current tab.
For example, following link will download the file but it will not appear in the network tab.
Click Here to Download file
Similar type of things can be done using javascript using (window.open, dynamic hyperlink/iframe), which will not appear in the network tab.
Various Javascript approach you can check here
I have observed similar behaviour in my past.
You cane check the chrome://net-internals in older version of chrome and chrome://net-export/ in the newer version of chrome to monitor any type of request being made by any instance/tab of chrome.
Note: You can check the internal events of chrome by typing chrome://net-export/ in the url box of chrome.
I have faced similar issue, and here's how I solved it.
Issue:
Debug an anchor link that download file upon clicking it.
Debugging Process:
Steps
Go to chrome://settings/content/automaticDownloads?search=download and disable auto download
Open chrome dev tools, Settings -> Global -> Auto-open DevTools for popup
Open chrome dev tools, Settings -> Console -> Preserve log upon navigation
I hope that helps.
This works without changing any settings of Chrome for a single download-request. It however does not automatically display all download-requests triggered in a different tab or window.
Trigger the download in the GUI.
Open Chrome's download history (chrome://downloads/).
Right-click your download and Copy link address.
Open DevTools, paste the link into the address bar of the corresopnding Chrome tab and execute it.
The download-request shows in the DevTools.
You can use Fiddler for a more grainy look into your network traffic:
https://www.telerik.com/fiddler
*I don't work for fiddler
What do you mean by capture?
If you meant that nothing showed up in preview tab or in response tab, it's because the response is the actual file being downloaded.
I've recently tried downloading Oracle JDK 11 with dev-tools open in network tab and here is what I got:
I have no particular configuration in this version of Chrome (Versione 71.0.3578.98 (Build ufficiale) (a 64 bit))
As #jlvaquero said, if you're trying to get as much details as possibile, try WireShark on your own local pc.
I can see it in my case by downloading a document from google drive and limit download speed to 3G.
First step : Open with f12 the programmer toolbar.
Step Two : Go to the networking tab and locate the video in question. To help filter by clicking on media.
Step Three : If the video has no protection you can right click, click open on a new tab and download with crtl + s. If this does not work is because the video has parameters to prevent it from doing so. In that case right click again, go to the COPY session and then click copy as cURL.
Step Four : Go to your linux terminal (If you use windows turn around), if you don't have curl installed type sudo apt install curl and then paste the copied CURL command from the developer bar.
Step 5 : Before executing the command you need to add at the end of it --output video.mp4 --insecure as it is a binary. The insecure parameter is if you have problem with certificate. Wait for the download to complete and be happy!
Obs: This link can help you: https://www.hanselman.com/blog/HowToDownloadEmbeddedVideosWithF12ToolsInYourBrowser.aspx
Google Chrome has been updated to support downloads in the Network Tab
This question was asked in February of 2018, and at the time Google Chrome did not support downloads in the Network tab.
I have verified this by downloading the 64.0.3282.140 build of Google Chrome.
And then attempted to download Spotify as an example and found no event appear in the network tab.
Any Google Chrome version released in 2019 or later will capture all download requests in the Network tab.

IntelliJ IDEA and Google Chrome fail to connect for JavaScript debugging

JetBrains IntelliJ IDEA sometimes loses its own JetBrains IDE Support plugin in Chrome. Upon debugging in IDEA, Chrome complains that:
hmhgeddbohgjknpmjagkdomcpobmllji is blocked
Requests to the server have been blocked by an extension
and stays on this page:
chrome-extension://hmhgeddbohgjknpmjagkdomcpobmllji/loading.html?__QUERY__
Where hmhgeddbohgjknpmjagkdomcpobmllji is JetBrains' plugin ID.
Instead of redirecting to the target page of the form:
http://localhost:63342/__PROJECT__/__PATH__/index.html
Restarting Google Chrome or disabling-and-enabling IDE Support plugin helps. IDEA "finds" Chrome again and Debug workflow works as intended.
Another possible problem is a failed authorization.
To debug a URL like this:
http://localhost:63342/__PROJECT__/__PATH__/index.html
Open it in the browser before starting to debug. It'll give 404 Not Found. Then switch back to IDEA and it will offer you to Copy authorization URL to clipboard:
http://localhost:63342/__PROJECT__/__PATH__/index.html?_ijt=__KEY__
Open this URL.
After this manual authentication is complete, IntelliJ IDEA should be able to debug index.html in Chrome.
IDEA always opens index.html for debugging in the browser window where the latest authentication happened. E.g., in a Chrome Incognito window, instead of a Chrome "normal" window, if you've just authorized IDEA in Incognito.
Going incognito may require an additional setup:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206201319-launching-chrome-incognito-in-intellij-12

Site cannot be installed: the page is not served from a secure origin

I have created manifest.json to a site to enable to save the web app icon on a desktop.
My developer website is over http - Which doesn't work when I click on add to home screen from application tab.
I am getting console error:
Site cannot be installed: the page is not served from a secure origin
The same code works over https.
How can I simply bypass this issue in http
Note : I have followed the following step in chrome browser, it didnt resolve my issue.
Stackoverflow previously Question
Any help will be greatly appreciated.
chrome://flags/#unsafely-treat-insecure-origin-as-secure
enabled and add site origin
The problem was service workers will only register and install on the secure origin. So followed following steps:
1) Go to chrome.exe path in the program files create shortcut of the chrome on the desktop
2) right click on the shortcut - Go to properties - update the target with the below changes
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --unsafely-treat-insecure-origin-as-secure=http://wzy.xyz.com,http://x.xyz.com --user-data-dir=/anydirectory/
Note: Make sure that you google chrome executable file is present in the above mentioned location.
Also this is only to test in the local environment.

Polymer serve and service worker

I am trying to get started on debugging my Polymer application. I have hand crafted it by copying what I think the PolymerCLI Polymer init does.
I am not sure what is loading service worker. The default one for development just does a console.info() call saying its been disabled for development.
When I use Polymer serve to serve my application on localhost: 8080, I get the console.info message, despite there being nowhere where I actually load the file service-worker.js . Because the application is much more complex (and I am trying to use http/2) I have my own node based server as well. When I run that and then fetch my application in the browser, service-worker.js does not get loaded and run.
What is Polymer serve doing to enable it?
It could be that a different application which used the same source (e.g. localhost:8080) registered and installed a service worker.
Open up the Application panel in Chrome Canary to inspect / delete the service worker.
If you can't access Chrome Canary, open chrome://serviceworker-internals, find the scope that matches your app, and click Unregister. There's also an option at the top of serviceworker-internals which lets you open a DevTools window and pause JS on the SW. Enable that option and you'll be able to see which SW is running.

Remote Debug "Chrome Mobile" to "PC"

I want to inspect and debug a Chrome Mobile application on my "chrome pc/machine",
so I've followed [this](http:// eveloper.chrome.com/devtools/docs/remote-debugging-legacy
) Google tutorial.
When I acessed localhost:9222, it lists the correct sites opened on my android chrome.
But the following error occurs when I click on "Inspectable pages". The console show the message
Document was loaded from Application Cache with manifest https://chrome-devtools-frontend.appspot.com/serve_rev/#178678/178678.manifest
Application Cache Checking event
[blocked] The page at 'https://chrome-devtools-frontend.appspot.com/serve_rev/#178678/devtools.html?ws=localhost:9222/devtools/page/0' was loaded over HTTPS, but ran insecure content from 'ws://<localhost>:9222/devtools/page/0': this content should also be loaded over HTTPS.
Uncaught SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
I encountered this problem too.
According to this report Chromium Issue 398817, you can add the --allow-running-insecure-content when launching Chrome.
This worked for me on Windows 7.