How to get Chrome to allow mixed content? - google-chrome

Chrome browser by default is blocking mixed content. How do I adjust my settings/configuration to allow mixed content without making any adjustments on the UI every time?
I have found two solutions but neither of them work:
Several articles say you can adjust this under the Security section
of "Under the Hood" in the Options. This option no longer seems to
exist. There is no Under The Hood tab and there is no such dropdown
to adjust how Chrome handles mixed content as far as I can tell.
Another option is to add the --allow-running-insecure-content flag
to your command line. I did this like so: "C:\Program
Files\Google\Chrome\Application\chrome.exe"
--allow-running-insecure-content. However this made no difference. If I tried adding the flag inside the double quotes, then Windows
complains saying it is invalid.
So what option do I have now with the latest version of Chrome?

Steps as of Chrome v91 (6/17/2021):
Click the Not secure warning next to the URL
Click Site settings on the popup box
Near the bottom of the list is Insecure content, change this to Allow
Close settings, go back to the site, and Refresh the page
Older Chrome Versions:
timmmy_42 answers this on: https://productforums.google.com/forum/#!topic/chrome/OrwppKWbKnc
In the address bar at the right end should be a 'shield' icon, you can
click on that to run insecure content.
This worked for me in Chromium-dev Version 36.0.1933.0 (262849).

In Windows open the Run window (Win + R):
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --allow-running-insecure-content
In OS-X Terminal.app run the following command ⌘+space:
open /Applications/Google\ Chrome.app --args --allow-running-insecure-content
Note: You seem to be able to add the argument --allow-running-insecure-content to bypass this for development. But its not a recommended solution.

The shield icon that is being mentioned was not in the sidebar for me either, however I solved it doing the following:
Find the shield icon located in the far right of the URL input bar,
Once clicked, the following popup should appear wherein you can click Load unsafe scripts,
That should result in a page refresh and the scripts should start working. What used to be an error,
is now merely a warning,
OS: Windows 10
Chrome Version: 76.0.3809.132 (Official Build) (64-bit)
Edit #1
On version 66.0.3359.117, the shield icon is still available:
Notice how the popup design has changed, so this is Chrome on version 66.0.3359.117.
Note: The shield icon will only appear when you try to load insecure content (content from http) while on https.

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" " --allow-running-insecure-content"

On OSX using the current Chrome build (2/20/2020, 79.0.3945.130), you can:
Click on the 'i' info icon on the left side of address bar.
Click Site Settings
Scroll down to Insecure content
Change it from Blocked (Default) to Allow
Reload the page and try your action again.

running the following command helps me running https web-page, with iframe which has ws (unsecured) connection
chrome.exe --user-data-dir=c:\temp-chrome --disable-web-security --allow-running-insecure-content

Another solution which is permanent in nature between sessions without requiring you to run a specific command when opening chrome is as follows:
Open a Chrome window
In the URL bar enter Chrome://net-internals
Click on "Domain Security Policy" in the side-bar
Add the domain name which you want to always be able to access in http form into the "Add HSTS/PKP domain" section

On OSX the following works from the command line:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-running-insecure-content

Chrome 46 and newer should be showing mixed content without any warning, just without the green lock in address bar.
Source: Simplifying the Page Security Icon in Chrome at Google Online Security Blog.

You could use cors anywhere for testing purposes. But its note recommend for production environments.
https://cors-anywhere.herokuapp.com/
something like: https://cors-anywhere.herokuapp.com/http://yourdomain.com/api

Related

Run standalone web app in Google Chrome without borders or toolbars

I need to run a web-based app inside Chrome but it must appear as if the app is standalone. I dont want any tools or frames to be visible.
Yes I know I can press F11 but this isnt sufficient as I dont want the tools to appear when I move the mouse to the top of the screen.
Do I need to go to the extents of making a Chrome extension and utilizing a possible fullscreen feature?
From the linux man page:
--app=URL
Runs URL in "app mode": with no browser toolbars.
e.g. invoke it with google-chrome --app=http://example.com
Start Chrome with the --kiosk flag. Then, no borders etc. will be shown. Furthermore, pressing F11 will not exit this mode, so it's the most effective way of running a Kiosk-like app.
chromium --kiosk http://example.com/
Replace chromium with the path of your actual Chrome executable (e.g. chrome.exe).
In the new Chrome (v88) it might be required to add --user-data-dir parameter to remove the title bar, so the line would go like this:
chrome.exe --user-data-dir=c:\temp --kiosk http://google.com
If you open Chrome in app mode, like Trever suggests, then borders will still be visible.
If you want a windowed app with no menus on mac, the steps have changed since #PaulR responded.
The new steps are as follows:
navigate to
chrome://flags
Enable the following two options:
"The new bookmark app system"
"Allow hosted apps to be opened in windows"
Restart Chrome to enable the options.
Then navigate to the page you want to turn into an "app".
In the tools menu (three dots) click More Tools > Add to Applications
Finally, navigate to
chrome://apps
and right click on the icon for the newly added Application. Enable the "Open as window" option.
Go ahead and create the shortcut, then open Chrome Apps chrome://apps. The shortcut icon should be in there. Right click on the app icon and check "Open as window." After that, the shortcut will open as a window.
Credit: Janos_
You can create create shortcuts from Chrome itself....
https://support.google.com/chrome/answer/95710?hl=en-GB
^ this link no longer works.
The feature is called "Create application shortcuts". To enable it in newer versions of Chrome, go to:
chrome://flags/
... using the address bar. Then find "The new bookmark app system" and Disable it. Then click Relaunch Now at the bottom of the screen.
Now, in the "More tools" menu there will be the "Create application shortcuts" menu entry.
There may be another way to do this, but this is just clarifying the method that was supposed to be described in the link.
Like many others have said, --app=<url> should do it for Chrome Version: 83.0.4103.61. The --kiosk option opens a chrome tab, not a borderless "app" window. I'm on macOS Catalina and decided to brew cast install chromium and ran:
chromium --app=https://netflix.com
Unfortunately I could not stream Netflix from Chromium..

How can I force a hard reload in Chrome for Android

In Chrome for desktop I have options in the dev tools to disable cache completely when dev tools are opened and I have the options to manually do a hard reload when long clicking on the reload button (with dev tools open).
Is there any such technique for Chrome for Android? I didn't find any setting.
What can I do when I want to force the browser to download some javascript or css file instead of using a cached one when developing?
I'm using window.location.reload(true) according to MDN (and this similar question) it forces page to reload from server.
You can execute this code in the browser by typing javascript:location.reload(true) in the address bar.
Viewing the page in incognito mode will disable the cache. It was the only way I could force a refresh on a stylesheet without manually clearing the cache through the settings.
Also an option:
Menu
Settings
Privacy
Clear Browsing Data
Check "Cache" and press "CLEAR"
and then reload the page.
You can use the Request Desktop Site option from the app menu (to the right of the address bar) which will force the page to reload.
Simply tap it, wait for the refresh, then deselect it.
Mentioning this because you mentioned "when developing".
You can control the mobile device via your Chrome Desktop Browser.
Visit chrome://inspect/#devices on your desktop. And Inspect the device that's connected to your desktop. Agree when asked for permission.
You should now see a full fledged Devtool window for the current page on mobile device.
Now, Use the hard reload shortcut (Cmd+Shift+R) on desktop to do hard reload on mobile device!
How to reset all data for a given URL / Website on Chrome Mobile for android:
1 - Open the Chrome menu, and tap on the "i (info)" icon
2 - tap "Site settings"
3 - Tap the trashcan icon
That's it, even the most deeply ensconsed service worker for that URL will now die.
Don't forget to make sure that the "Reduce data usage" setting is turned OFF, as it seems to download cached data (from Google servers?) even though your local cache is flushed.
I know this is an old question, but I found that the accepted answer didn't work for me.
An alternate solution would be to append the url with a new url parameter
such as website.com?a=1, website.com?a=2, etc.
If you have parameters already, of course, you would use an ampersand
i.e. website.com?q=test&a=1
As of 2018, from google help center (tested on Chrome 63) :
tap on the three dots menu ;
choose History > Clear browsing data ;
if needed, choose the time period (above the checklist) ;
uncheck all items but Cached images and files ;
proceed with Clear data and confirm.
As mentioned in another answer, incognito tabs are also of great use for development.
I found a solution that works, but it's ugly.
Connect the Android device to your PC with a USB cable and open Chrome on your desktop.
Right-click anywhere on a page and select "Inspect".
Click the three-dot menu and select "Remote devices" under the "More tools" menu:
In the panel that opens, select your device and then the "Inspect" button next to the name of the tab on your phone that needs to be refreshed:
In the window that opens, click the "Network" tab and check the "Disable cache" checkbox:
Reload the page on your phone or using the reload button in the DevTools window.
Note: if your phone doesn't appear in the device list:
make sure the USB connection is using File Transfer mode and isn't simply charging
try restarting ADB or run adb devices to see if the device is being detected
The only reliable way I've found that doesn't require plugging the phone in to a PC is as follows:
1. Force stop the Chrome app.
This must be done first, and you cannot re-open Chrome until you finish these steps. There are several ways to force stop. Most home launchers will let you get to "App info" by holding down your finger on the chrome icon and selecting an "i" icon. Alternately, you may be able to go to Android settings and simply search for "Chrome".
Once in "App info", select "Force stop" as shown below:
2. Clear Chrome's cache
Select "Storage" from the same screen:
Finally, select "Clear cache".
When you return to the Chrome app, the page should reload itself and serve a non-cached version.
Additionally, I found a site that makes it easy to test if you've cleared your cache: https://refreshyourcache.com/en/cache-test/
I am in no way affiliated with it. Note that the method to clear the cache mentioned on that site is in fact outdated and no longer valid.
Keyboard shortcuts such as Ctrl+Shift+R work on Android too, you just need a keyboard capable of sending these keys. I used Hacker's Keyboard
to send Ctrl+Shift+R, which did a hard reload on my phone.
Recent versions of Chrome cache very aggressively. Even cache-busting techniques such as "http://url?updated=datecode" stopped working. You must clear the cache or launch an incognito window every time (and make sure data-saver is off).
Remote Debugging allows you to use the desktop dev-tools:
https://developers.google.com/chrome-developer-tools/docs/remote-debugging
If its just the matter of included files, just add version after the path (?v=12345678)
<link rel="stylesheet" type="text/css" href="style.css?v=12345678" />
Whoever loads the page again will see changes.
Most of the answers were not working for me.
Here is a super simple working on my Galaxy S8 in august 2020:
Add "view-source:" just before your http:.... address, navigate trough there to the changed file if different than the html or index.
You will see the unchanged file. Refresh.
Done.
EDIT: This method has been deprecated in Google Chrome and will no longer work.
ORIGINAL ANSWER:
I was able to clear the cache (including subsequent xhr) using chrome://net-internals
Then click the little arrow in the top right
Select "clear cache" from that menu.
Here is another simple solution that may work when others fail:
Today, a fairly simple developer-side solution worked for me when the caching problem was a cached CSS file. In short: Create a temporary html file copy and browse to it to update the CSS cache.
This trick can refresh the CSS file, at least in Android's blue-globe-iconed default browser (but quite likely its twin, the official Chrome browser, too, and whatever other browsers we encounter on "smart"phones with their trend of aggressive caching).
Details:
At first I tried some of the fairly simple solutions shared here, but without success (for example clearing the recent history of the specific site, but not months and months of it). My latest CSS would however not be applied apon refresh. And that even though I had already employed the version-number-trick in the CSS file-call in the head section of the html which had helped me avoid these pesky aggressive cachings in the past. (example: link rel="stylesheet" href="style.css?v=001" where you upgrade this pseudo-version number every time you make a change to a CSS file, e.g. 001, 002, 003, 004... (should be done in every html file of the site))
This time (August 2019) the CSS file version number update no longer sufficed, nor did some of the simpler measures mentioned here work for me, or I couldn't even find access to some of them (on a borrowed android phone).
In the end I tried something relatively simple that finally solved the problem:
I made a copy of the site's index.html file giving it a different name (indexcopy.html), uploaded it, browsed to it on the Android device, then browsed back to the original page, refreshed it (with the refresh button left of the address bar), and voilà: This time the refresh of index.html finally worked.
Explanation: The latest CSS file version was now finally applied on Android when refreshing the html page in question because the cached copy of the CSS file had now been updated when the CSS file was called from a differently named temporary html page that did not exist anywhere in the browser history and that I could delete again afterwards. The aggressive caching apparently ignored the CSS URL and went instead by the HTML URL, even though it was the CSS file that needed to be updated in the cache.
Adding a parameter to url fool browser to load a new page. I wrote a fuction for that purpose:
function forceReload(){
function setUrlParams(url, key, value) {
url = url.split('?');
usp = new URLSearchParams(url[1]);
usp.set(key, value);
url[1] = usp.toString();
return url.join('?');
}
window.location.href =setUrlParams(window.location.href,'_t',Date.now());
}
And you just need to call it:
forceReload();
I've struggled with this for a CSS file that wouldn't refresh. But you can type the name of the CSS file itself into the address bar and refresh that. After that it's fine. Chrome on Android 8. Obviously that would be tiresome if you had more than a couple of files involved.
If that's an option, you can visit the (i.e. JavaScript) resource directly, reload a bunch of times, and that also triggers a hard reload for that resource. Then you can reload the actual page again.
Launch the Chrome Android app
Tap on the menu for more options.
Select Settings from the list of options.
Scroll down and tap on the Site Settings tab.
Within the Site Settings open the Data Stored tab.
Tap on the Site URL that you want to delete storage.
Hit on the Clear & reset command button.
refresh the website page.
there are few methods to force reload chrome on mobile device:
clear history (look above)
use remote debugging (look above)
request desktop site
disable "Lite mode"
open URL for .JS or .CSS then do normal reload.
In chrome,simply tick "Desktop site" and then remove tick!!

How to disable cache on chrome for Android?

How to disable cache on chrome for Android?
I change my page content, and refresh the page, but the content still is old.
I have set the nginx config like below, but it has no effect.
#disable cache
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma no-cache;
add_header Expires 0;
Is there a way to get my newest page without manually clear cache again and again?
This may not be the easiest way, but it will 100% work and should be part of your development setup anyway.
Using Google Chromes web tools on Windows or Mac will allow you to do "remote debugging".
Enable remote debugging on Android device through Developer Menu in settings.
Connect phone to PC using USB
Open Google Chrome and access the developer console (F12)
Click on the three dots (top right) > more tools > Remote devices.
Scroll down to select your mobile device, at this stage you should see all chrome instances open on your phone. Select the instance you wish to "force reload and disable cache" by pressing Inspect
Another screen should appear allowing you to access the network tab and select "Disable Cache"
Currently there is no way to disable cache on chrome for Android but it is possible to clear the cache.
UPDATE: As of now there is a way to disable cache with requires your phone to be connected and needs remote debugging, please refer to Dean Meehan's answer for more info
Follow these steps to clear the cache.
http://www.refreshyourcache.com/en/chrome-android/
Click on the menu button (three dots in the topright corner).
Click on Settings in the menu.
Click on Privacy in the menu.
Click on Clear browsing data... at the bottom.
Select Empty the cache from the list.
Confirm clear browsing data.
I know the question is asking about disabling cache on chrome for Android, but this may help people looking for a solution to mobile development.
To see changes on your website with your Android device use the New incognito tab in chrome web menu.
Click top right drop down menu in chrome browser
Click "New incognito tab"
Navigate to your website and see all your most recent changes.
IMPORTANT: To see new changes after viewing with incognito, you must close the incognito mode completely and reopen due to the current tab also caching.
To disable the cache first you'll have to disable scripts / css caching on the ones you are editing.
In order to do that, add a timestamp to your file inclusions :
<link rel='stylesheet' href='/static/css/main.css?t={{ts}}'/>
<script type='text/javascript' src='/static/scripts/main.js?t={{ts}}'></script>
{{ts}} being a timestamp (I'm using jinja templating).
Then if you edit your html page, you could change the request adding a random parameter to it as such :
test 1 :
mywebsite.com/this_page
test 2 :
mywebsite.com/this_page/?i=1
test 3 :
mywebsite.com/this_page/?i=2
...
It's more a hack than a real solution, but chrome kindly ignores the cache-control meta, so there aren't lots of clean way to do it.
The following bash script will rename
<script src="path/to/app.js"></script>
to
<script src="path/to/app.js?t=18:15:45></script>
in an index.html file, which will prevent mobile caching.
#!/bin/bash
time=$(date +"%T")
sed -i "s/app.js/app.js?t=${time}/" ./path/to/index.html
Download this app : App Cache Cleaner
Open the app
Go to the app settings via the '3 dotted' button
screenshot
Tick mark the option to show widgets and the rest is upto you
You may as well disable Chrome's Data Compression policy and preloading of pages.
As of now, there are no 'disable cache' option in chrome
screenshot2
PS:i cud not show pictures because of my low rep, help me increase that too ;p

How can I run Chrome without all browser's controls (tabs, address line, buttons)?

How can I run Chrome without all browser's controls (tabs, address line, buttons)?
only page-area loaded with specific URL
Thanks
Assuming you want to open a specific URL (let's say http://www.example.com), here are 3 options for your consideration. For all options, start by creating a shortcut to Chrome.exe, which you will edit by adding a flag/switch to the 'Target' property of the shortcut.
Open as an App - Use a 'Target' like this:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app=http://www.example.com
This will open the web page in a generic Windows window, with no browser Chrome available although you can still access browser tools, e.g., pressing F12 to open Developer Tools.
Open Fullscreen - Use a 'Target' like this:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://www.example.com --start-fullscreen
This will open the web page in a Chrome window, which will start fullscreen unless there is another instance of Chrome already open, in which case the page will open in that instance. If you press F11, the browser will return to its normal view mode.
Open in Kiosk Mode - Use a 'Target' like this:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://www.example.com --kiosk
This will open the web page in a Chrome window, which will start in Kiosk mode unless there is another instance of Chrome already open, in which case the page will open in that instance. From my understanding, the only way to close this would be to press Alt+F4.
As mr_kazz explained, you can refer to http://www.chromium.org/developers/how-tos/run-chromium-with-flags to see which flags you can use to when launching a Chrome shortcut.
You'll need to start Chrome in "Kiosk mode"
Here is a tutorial for windows: http://think2loud.com/868-google-chrome-full-screen-kiosk-mode/
If you are building a more elaborate kiosk solution, you would put this command in a shell/bash script that would continuously run it (and wait for exit before doing it again). This was if your user pressed Alt+F4 it would just start it again.
http://www.chromium.org/developers/how-tos/run-chromium-with-flags
The above page links to a page with a huge list of arguments, maybe it can be achieved that way. I would also like to know how this can be done.
I currently use this for opening µTorrent server's webUI
chromium-browser --window-size=900,700 http://admin:#localhost:8080/gui/
Run it with the "--kiosk" switch:-
"C:\Program Files\Google\Chrome\Application\chrome.exe" --kiosk
or wherever else it might be installed.
You can open the webpage as an app. To find out how to do so, search a search engine for "open chrome webpage as app" and follow the instructions. I could paste the instructions here, but once you know how to search for it, it's pretty easy.

How can I get Aptana to work with Google Chrome?

Is there a way for me to get Google Chrome to launch in Aptana?
I tried adding it under Web Browsers but when launching the webpage, from Aptana, it launches it in Firefox instead.
Selecting Default system browser doesn't work either.
How I would do it is where the green > button is, at the top (next to debug), go into run configuration and add a new entry for google chrome.
The path for chromes exe is at (Win7)
C:\Users\USERNAME\AppData\Local\Google\Chrome\Application\chrome.exe
WinXP
C:\Documents and Settings\<username>\Local Settings\Application\chrome.exe
Then you can run that straight from the drop down menu. This is the way I do it, however it may not be applicable for your situation.
I added Chrome to the Run Configurations ...
I deleted Firefox from the General > Web Browser settings.
I restarted Aptana Studio 3 and now, when I click on the green arrow run button, Chrome is the browser.
Say hello to F12 and debugging HTML and JavaScript with ease.
I have Windows 7 and followed the advice listed above for the 'green button'. For Chrome, my file path was "C:\Users\user name\AppData\Local\Google\Chrome\Application\chrome.exe". It was very simple and worked beautifully. Thank you.
rickyduck's answer applies but the path to Chrome may have changed in newer versions to :
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
That's the path I had to use.
rickyduck's answer is exactly what I have been looking for! Thanks Ricky!
To get the exact path to chrome on your machine, just go to your start menu, type in chrome and when it comes up, right click on it and select the Shortcut tab to copy the target path and paste right into Aptana.
Another way to directly launch chrome upon pressing green button is to delete other browsers from run -> run configuration -> web browser . . . and leave chrome alone . . if you want other browsers you can add later on . .
You can add as many browsers as you want. Click on Run -> Run Configurations then right-click on Web Browser in the left nav pane, then select New. Use the Browse button to get the application path then at the top of the dialog, type in a descriptive name. Click Apply and Close. You now have more than one browser to choose from for testing.
I added Chrome to run configurations, and deleted Firefox and IE, also changed likewise under General Web Browsers. The Chrome tab doesn't show up on Green dropdown. If I exit program and restart, the Firefox and IE are back again, but still now Chrome.
Click the tiny black arrow thats looks at the bottom and is located at the top, next to the green Run button:
Choose Run Configurations and then you should see a Browser executable field, under the Web Browser tab:
where you want to click Browse, navigate to the Google Chrome executable (at my Max OS X at El capitan: Applications -> Google Chrome) and double click on it.
Then, click Apply (in the Run Configurations window). Then Run.
That's it! :)
Tested with Aptana Studio 3, installed like this on Mac.