Can't open some html files in chrome (mac) - html

There are some HTML files (no pattern that I've figured out) that I can't open via the terminal, GUI or right clicking Open in Browser via Sublime Text 3.
The default browser to open the file is definitely set to Chrome. When I say to open the file in the browser it takes me to the Chrome window, but doesn't actually open the file I want.
I can open these files in Chrome itself via command + O and in Firefox or Safari by right clicking on the file and selecting them in the GUI.
It'd be great if Chrome would open files when I expect it to. I'd appreciate any help.

I had the same problem. Fixed it by running this in the terminal after closing Chrome:
open /Applications/Google\ Chrome.app --args --allow-file-access-from-files
The command line args can be viewed in Chrome by visiting chrome://version/
Chrome didn't load local files for me before running this command, but for some reason Chrome Canary did.

On your mac, right click the file and choose 'Open with' and then choose 'other'. Change the default to 'Safari' and then check the 'Always Open With' box. Click open. This should launch the file in Safari. Close the file in the browser and verify that double-clicking it will open it in Safari. Now do the same thing again except change the default back to Chrome.
You may have some security issue if you downloaded the *.html file from somewhere else.

None of the previous answers worked for me, but this one did:
On your Mac, choose Apple menu >> System Preferences >> click Security & Privacy >> click Privacy.
Select Files and Folders.
Please select the checkbox below the Nicepage application to access files and folders in that location.
Source: https://nicepage.com/doc/84207/access-denied-for-documents-folder-macos
Good luck, lads

it's a problem of extend attributes. If you use ls -l to see the attributes of your file, you will see some weird # .
ls -l xxxx.html
-rwxr-xr-x#
the solution is to use xattr.
xattr -c filename
xattr -rc directory

The solution provided by Xiaoou Wang works.
Explanation
I would like to extend this answer and provide below a different solution, which was not given yet.
Chrome (Mac) indeed does not open .html files that have the extended attribute com.apple.quarantine. This attribute is automatically applied on files that are downloaded from the web and are not Apple-authorized applications.
From the terminal, by typing
xattr 'your .html file name'
you can verify whether your .html file has the quarantine attribute set.
With xattr -c command you will remove all attributes, in case there are others set. If you want to only remove the quarantine attribute, type instead
xattr -d com.apple.quarantine 'your .html file name'
Alternative solution
This alternative solution might be even simpler for some people. With my Chrome (mac) I can open .html files by simply dragging the file from finder onto an already opened Chrome window, in spite of their com.apple.quarantine attribute. Important: It does not work if you drag the file onto Chrome's icon in the dock.

There might be an issue with your permissions settings. I tried everything and this is worked for me:
Open your Google Chrome Browser:
click Chrome,
open Preferences,
click Privacy and Security,
click Advanced (at the bottom),
scroll down to "Downloads",
under Location click the Change button.
Then choose where the file you are attempting to open is saved.

you can open this html file and try "command + option + I" to see the file content in the console window, if it's real html file there will be source code reveal. i don't think it can be the chrome's problem.

Related

Is it possible hyperlink open in non default browser.

can u explain?
Actually my default browser is IE in my system and i have created .html file.But file is open in IE(my default browser). My file is open in IE than after click link to open in another browser.is it possible?
If yes,so please give me syntax.
Thanks & Regards,
Kapeesh
My file is open in IE than after click link to open in another browser.is it possible?
No, it's impossible.
As an alternative you can try to open your file in non-default browser at once (if your page has an URL).
To do so you have to create a shortcut-file to your browser and add file URL as a parameter:
"c:\Program Files (x86)\Mozilla Firefox\firefox.exe" "https://my-site/page.html"
This shortcut will open Firefox with your page.

"Open with" Chrome in the Command-Line

I want to open a html-file in Chrome by using the command-line without setting Google Chrome as default-browser. How can I do this, when I don't know the path where Chrome is installed?
I'm in the folder where the file is lying:
start page.html
Does there any "open with" Chrome function exist?
I need a solution, where I don't have to navigate to the path where chrome is lying.
Thanks!
This command will work.
For Google Chrome:
start chrome page.html
For Firefox
start firefox page.html
But start iexplore page.html will not work.
If you don't know the absolute path to the Chrome executable then you're reliant upon it being on the $PATH environment variable (or %PATH% on Windows). If Chrome has been installed normally, then it's probably on the path anyway.
You can try running chrome page.html on the command line. If the Chrome executable is on the path then this will open successfully and try to open page.html in a tab.
If the executable is not on the path then you will need to know the absolute path to it and run something like this instead: /absolute/path/to/chrome page.html or C:\Path\To\Chrome\chrome.exe page.html on Windows.

How to get Chrome to allow mixed content?

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

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.