browser extension - customize ERR_BLOCKED_BY_CLIENT window [duplicate] - javascript

I am building a new extension and I would like to customize the default error page in Google Chrome. I have gone through the "Override Pages" documentation here but have yet to find anything about customizing the page I have specified.
Any suggestions are much appreciated. Thank you.
The error page I want to customize is:
This webpage is not available
The server at ____ can't be found, because the DNS lookup
failed. DNS is the network service that translates a website's name to
its Internet address. This error is most often caused by having no
connection to the Internet or a misconfigured network. It can also be
caused by an unresponsive DNS server or a firewall preventing Google
Chrome from accessing the network. Here are some suggestions: Reload
this webpage later. Check your Internet connection. Restart any
router, modem, or other network devices you may be using. Check your
DNS settings. Contact your network administrator if you're not sure
what this means. Try disabling network prediction by following these
steps: Go to the wrench menu > Options > Under the Hood and deselect
"Predict network actions to improve page load performance." If this
does not resolve the issue, we recommend selecting this option again
for improved performance. Add Google Chrome as a permitted program in
your firewall's or antivirus software's settings. If it is already a
permitted program, try deleting it from the list of permitted programs
and adding it again. If you use a proxy server, check your proxy
settings or contact your network administrator to make sure the proxy
server is working. If you don't believe you should be using a proxy
server, adjust your proxy settings: Go to the wrench menu > Options >
Under the Hood > Change proxy settings... > LAN Settings and deselect
the "Use a proxy server for your LAN" checkbox.
Error 105 (net::ERR_NAME_NOT_RESOLVED): Unable to resolve the server's
DNS address.

The chrome.override isn't meant for this. Instead you can detect a DNS resolution error using chrome.webRequest API. If you see this error you can load a different URL into the tab. Something along these lines:
chrome.webRequest.onErrorOccurred.addListener(onErrorOccurred, {urls: ["http://*/*", "https://*/*"]});
function onErrorOccurred(details)
{
if (details.error == "net::ERR_NAME_NOT_RESOLVED")
chrome.tabs.update(details.tabId, {url: "..."});
}

Related

Private Network Access problem w/ disabled web security: Request had no target IP address space, yet the resource is in address space local

We have a test environment on a public site. There we use --disable-web-security flag on chrome for the testers to bypass CORS errors for public service calls during manual test phase. And also we have localhost requests on the agent machine. However today with Chrome 98 update we started struggling with the network requests targeting localhost.
The error we get is for the localhost requests from a public site:
Access to XMLHttpRequest at 'https://localhost:3030/static/first.qjson' from origin 'https://....com' has been blocked by CORS policy: Request had no target IP address space, yet the resource is in address space `local`.
The site on localhost is configured to return Access-Control-Allow-* CORS headers including "Access-Control-Allow-Private-Network: true".
And also I do not see any preflight request. Just one GET request with CORS error on it.
We suspect this might be a side effect caused when you disable web security by --disable-web-security. It might be preventing obtaining of the target IP address space. Our assumption is based on the CORS preflight section on https://wicg.github.io/private-network-access/
3.1.2. CORS preflight
The HTTP fetch algorithm should be adjusted to ensure that a preflight is triggered for all private network requests initiated from secure contexts.
The main issue here is again that the response’s IP address space is not known until a connection is obtained in HTTP-network fetch, which is layered under CORS-preflight fetch.
So does anyone know any workaround for Private Network Access with --disable-web-security flag ?
Or maybe we are missing something. Thanks for the help.
Below Steps can help to solve issue in chrome 98, for other browser like edge you need to do similar like chrome.
For MAC
Requestly with chrome version 98. You need to follow following steps :- Run this command on terminal
defaults write com.google.Chrome InsecurePrivateNetworkRequestsAllowed -bool true
Restart your Browser, Not work then restart your machine
For WINDOWS
Run 'regedit' to open windows registry (If permission issue came then run that command with Admin command prompt)
Go to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome
Create new DWORD value with "InsecurePrivateNetworkRequestsAllowed" Name
Change Value to "1"
Restart your Browser
LINUX
for linux users you have to create a policy file in this path:
mkdir -p /etc/chromium/policies/managed
# for chrome you should change the path to this
# /etc/opt/chrome/policies/managed
and then create a new json file for policies:
cd /etc/chromium/policies/managed
touch dev_policy.json
and put this content in it:
{
"InsecurePrivateNetworkRequestsAllowed": 1
}
for chrome:
{
"InsecurePrivateNetworkRequestsAllowed": true
}
that is it, next time you start chrome on your machine it will load this new policies.
p.s. you can check if the policies are correctly loaded in here: chrome://policy/

Failed to load response data with Chrome on HTTPs

I have some troubles to start my WebApp with Chrome (not always).
My webApp is a simple Javascript App and it's loaded using HTTPs. The server providing the WebApp resources is using a self signed certificate that is not trusted by Chrome (same for Firefox...).
When a user starts for the first time the WebApp (or after cleaning the Chrome's cache) using an URL like https://mywebapp:8443/ui the user gets a message that the website is not trusted (ERR_CERT_AUTHORITY_INVALID) but the user can continue (it's the expected behavior).
Next, there's the issue: Chrome starts loading my webApp by getting the index.html and then the .css but it's unable to get the .js that contains the Javascript code of my webApp.
In the Chrome Development tool, I can see the response of the HTTPs request to get the .js file is "Failed to load response data".
I don't understand why there's this error with Chrome (it never happens with Firefox).
Next, if I reload the page in Chrome, the WebApp is successfully loaded and displayed.
I can reproduce this issue when I'm cleaning the cache in Chrome. If I'm not cleaning the cache the WebApp continues to work even after a Chrome restart.
Can it be due to the self signed certificates? What can be the reason of this issue during the first start? Why it happens only with Chrome?
Thanks for your help,
I guess it's due to using a self signed certificate,the newest Chrome Brower don't allowd trust self signed certificate,so your own certificate is not trust by chrome!
You can into chrome://net-internals/#hsts in brower address blank,then delete 'localhost' in HSTS list.
I was wrong, the issue was also appearing in Firefox.
I have found the root cause, it was due to the backend that uses a Kong cluster between the WebApp running in the web browser and the tomcat server that is located behind Kong.
An important things is that I'm also working in a DC/OS environment and between the WebApp and the Kong there's a marathon-LB !
Ok, the issue is the marathon-LB is dispatching the requests from the WebBrowser to one of the Kong from the cluster. Each Kong has its own self-signed certificate and as a consequence, the web browser gets responses from the same IP# signed with different certificates (since each request is managed by a different Kong).
When I configure the Kong cluster with only one instance everything work well because it's always the same Kong that is responding and all requests are signed with the same certificate.
The solution is to configure the marathon-LB with a certificate and then only this one will be forwarded to the WebBrowser instead of the Kong certificate.

How can I bypass CORS security in a browser?

I have a Javascript application running in a browser, and I want to access some data sitting in a server that can't enable CORS.
It's not a testing application, is meant for the end-user, even if a little techy one.
I considered:
PHP Proxy: Not appropriate. Server on the other side make decision about IP geolocation.
Java/SilverLight: Unfortunately my #1 target is Chrome
JSON: Not available
What are my options?
Please notice that I'm not trying to make any malicious application: if the user need to approve or allow me to make this request is totally fine.
You are trying to do exactly what the Same Origin Policy is designed to prevent (and what CORS is designed to allow the server to permit).
Your options are:
Find a way to work with whomever controls the server
Get the users to download and install software which isn't subject to the Same Origin Policy (such as a stand-alone application or a browser extension).
You need to ask your users to install chrome extension to overcome CORS. I used to use it while developing ionic apps and testing on chrome
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en
https://chrome.google.com/webstore/detail/cors-toggle/omcncfnpmcabckcddookmnajignpffnh?hl=en

How to allow Chrome to access my camera on localhost?

I cloned a project about real-time image processing on a web browser from this link:
Then I could not allow my browser to access my camera.
I got this javascript alert:
Uh-oh, the webcam didn't start. Do you have a webcam? Did you give it
permission? Refresh to try again.
And the allow button is not shown as if I access his site.
To ignore Chrome’s secure origin policy, follow these steps.
Navigate to chrome://flags/#unsafely-treat-insecure-origin-as-secure in Chrome.
Find and enable the Insecure origins treated as secure section (see below).
Add any addresses you want to ignore the secure origin policy for. Remember to include the port number too (if required).
Save and restart Chrome.
I found solution from below link.Hope it will help to someone
https://medium.com/#Carmichaelize/enabling-the-microphone-camera-in-chrome-for-local-unsecure-origins-9c90c3149339
Are you accessing the webpage that is served over HTTP, on localhost? If you are accessing it from http://localhost/... , Chrome will ask for your permission to use the camera.
If you are opening the web page directly, i.e. /Users/Methuz/Documents/index.html then it will not work, even if you explicitly allows it permission
In this case, the workaround I use is to host the HTML file on a webserver. A quick hack is to use python, in the folder where the HTML page is lcoated: python -m SimpleHTTPServer
Step 1:
Find your chrome preferences file:
http://www.forensicswiki.org/wiki/Google_Chrome#Configuration
Step 2:
Open it and Find the "profile" key
Step3:
Under profile there will be a "content_settings" hash, that will have a "pattern_pairs" hash
Add this to it:
"*,*": {
"media-stream-camera": 1
}
Final example:
"profile": {
....
"content_settings": {
....
"pattern_pairs": {
"*,*": {
"media-stream-camera": 1
},
....
}
}
}
WARNING: This will allow all websites access to your camera
Chrome now only allows https:// servers to persistent list (version 39.xx)
https://support.google.com/chrome/answer/2693767?hl=en
Allow: This allows the site to access your camera and microphone at this time and a notification will appear confirming that you’ve granted access. If you select Allow on a "http" URL your preference will not be remembered in future visits. If you select Allow on a "https" URL, your preference will be remembered in future visits.
Maybe this link helps to set your local secure server if you are using Wamp.
http://forum.wampserver.com/read.php?2,32986
Then you can add your local server to persistent allow list of chrome.
Got this problem for days, only this helped:
Reinstall Chrome by removing configuration as well. And try not to sync all the extensions, as they may interfere.
sudo apt-get purge google-chrome-stable
rm -rf ~/.config/google-chrome
Then install from official.
Another solution is to use iframe tag. Jest deploy your page on server (localhost or external) and include it in your local html.
Example:
<iframe src="http://localhost/your_project/index.html"></iframe>
Chrome on HTTP or any other port won't save the preference of Camara share choice.
To save the selection you will need to run on HTTPs, even if you don't have SSL certificate on localhost that fine. Just add https before the localhost url and it will ask you its unsafe, if you want to proceed add it as an exception under Advance options. Do that and then Chrome will save you camera sharing preference for this website. and won't ask you to select allow
You can choose a different default permission setting and manage exceptions in Content settings.
Click the Chrome menu Chrome menu on the browser toolbar.
Select Settings.
Click Show advanced settings.
In the "Privacy" section, click Content settings.
In the "Media" section:
* Ask me when a site requires access to my camera and microphone: Select this option if you want Chrome to alert you whenever a site requests access to your camera and microphone.
* Do not allow sites to access my camera and microphone: Select this option to automatically deny any site requests to access your camera and microphone.
Or click Manage exceptions to remove previously-granted permissions for specific sites.
Source: https://support.google.com/chrome/answer/2696491?hl=en
P/D: the link you provided has an error. I can't access.
Open localhost/webcam.swf
then right click on the flash file then allow the webcam and tick remember
that will add exception for localhost

Javascript web application does not show certificate not trusted in Chrome

I have an application using https to do a jsonp call on my server which is self signed.
If I use the corresponding url in the Chrome address bar, then a warning is showing with 'The site's security certificate is not trusted!'. There the user can proceed anyway.
Now in my web application, there is no such warning and the request just remains pending indefinitely. I can see that in Developer tools. I would expect having something showing on chrome similar to the above behavior.
Chrome version is currently 25.0.1364.172.
Is this normal?
What should I do to address this problem?
Thanks!
Unfortunately this is normal. Try to browse via firefox, backup the Certificate and install it in Chrome again.

Categories

Resources