There are 2 ways for opening .html files in Google chrome.
Way 1 :
Right click on the .html file and select open with Google chrome.
Way 2 :
- Open Google Chrome
- Press ctrl + o
- A window opens
- Navigate to your destination folder and click on your .html file
That's it. There you go.
Hope This is helpful.
Answer from Areg Nikoghosyan on Stack OverflowThere are 2 ways for opening .html files in Google chrome.
Way 1 :
Right click on the .html file and select open with Google chrome.
Way 2 :
- Open Google Chrome
- Press ctrl + o
- A window opens
- Navigate to your destination folder and click on your .html file
That's it. There you go.
Hope This is helpful.
Just paste the path of the html file including the .html to the browser. Eg, c://Desktop/user/project/file.html -> paste on url
I considered it a no-brainer. I was wrong.
I wanted to take along some files to read when I'm out of network reach or in flight mode. The files happen to be quite plain HTML files, no script, just a CSS file defining the simple layout, and that's it. So I copied the HTML and the CSS files onto my phone and tried to open them.
First attempt was from a file manager. It told me that it no idea what to do with an HTML file. I then tried to look for an "open file" entry in Chrome. Nope. Same in Firefox. Then I tried to force-open the files by using a file:///path/to/file style URL - and it actually submitted the whole string to Google as a search string, as if Chrome (and Firefox) had been lobotomized of the file: protocol.
Now I'm at a loss - is there no way to open a simple HTML file on an Android 13 phone?
Videos
I use Mac and not familiar with Vscode I want to open some html file in Chrome so far I try two methods :
First , click Run and Debug, html opens to safari which i dont want that . Second , I choose launch Chrome selection in nav bar , it launchs Chrome page but it’s an error page.
After thet I open html by using terminal by using open command : open index.html the files opens in safari
How can I fix that ? Thanks in advance .
You can use a local server to host the webpage, and navigate to the private IP of your pc from your mobile device if they are connected to the same network.
I prefer live-server npm package for this. Simply type npm install -g live-server. Navigate to the directory your website is located at then run live-server. It will also show the port you are running on.
To find out your private ip address, open another command line and type ifconfig (or ipconfigif you are on windows).
Navigate to ip-address:port-number in your mobile device and you will see your website. Example private ip address and port number: 192.168.1.40:8080
The easiest way for previewing on the mobile device is using websites such as : https://search.google.com/test/mobile-friendly? I hope this helps you to determine your problem.
You have 2 options:
You can use a local web server in your Android phone itself. There are many server apps out there in the Play Store, one such app is Simple HTTP Server.
You can put your documents into the folder
Android/data/com.android.chrome/files/Download/in the internal storage. It's absolute path is/storage/emulated/0/Android/data/com.android.chrome/files/Download/or/sdcard/Android/data/com.android.chrome/files/Download/. This is the location where Chrome stores any downloaded files and therefore, this the only location where Chrome can access the files. But remember, uninstalling Chrome will delete this directory.
For Android 11 [One UI 3.1]
Browsing local files (in internal storage space) in Chrome using file:///sdcard/ or file://localhost/sdcard/, one can notice that only media files and subdirectories (if any) are listed in almost every folder except the "Download" folder (but not in its subfolders=subdirs).
This means that on Android 11, the folder from which Chrome can read local (m)HTML is /Download folder, not Android/data/com.android.chrome/files/Download in internal or external storage space like in Android 10.
NOTE: on my Samsung devices, downloads onto internal storage were saved into /Download folder in all versions of Android (9, 10, 11), but downloads on an external SD card changed their folder from /storage/emulated/exSD_CARD/Android/data/com.android.chrome/files/Download in Android 10 to /storage/emulated/exSD_CARD/Download in Android 11, where exSD_CARD is the device's label for external SD card (0123-4567 or 9C33-6BBD in my devices)
Thus, (m)HTML files saved into /Download folder with Chrome (with .mhtml extension from older times or with manually added extension by renaming saved mhtml files without extension - from certain time Chrome stopped to append .mhtml extension to saved mhtml files :) on my devices, I guess from upgrading to Android 10)
This did not work for the mhtml files which have been moved to other folders and then returned to /Download folder. (And because of collecting saved mhtml files in many different folders, I have many mhtml files which are necessary to copy/move back to /Download folder prior to opening but they still cannot be opened)
Notes about opening mhtml files
I need to use Total Commander's "Open with" functionality with file://url option checked, then choose Chrome in order to open (mhtml) file with Chrome (with file://url checked, the Chrome is in the list to choose from, with file://url option unchecked, it is not listed in the list) or to browse local files in internal storage directly in Chrome (file manager My Files provided with the device was unusable to choose mhtml files to be opened with Chrome)
(mhtml) files from /Download folder opened in this way are opened as offline versions of downloaded web pages - but only if the file was not moved and returned back to /Download folder, otherwise you get Access Denied message. Also, opening (mhtml) files in this way using Total Commander, but from other folders than /Download folder, leads to Access Denied message
Opening mhtml files from any folder using Total Commander, but with file://url option unchecked (in this case, the Chrome is not in 1st list, so you need to choose "Open with *" option with folder icon from the list and subsequently choose Chrome from next list) behaves differently. Opening in such a way leads not to successful opening or Access Denied message but to Save as Dialog Form in which one can choose also if the resaved mhtml file should be saved to internal storage or external SD card (if present). In this way, resaved mhtml files in /Download folder (on internal or external storage space) can be now opened using Total Commander "Open with" dialog with checked file://url option.
Still, there exists a way of opening the (m)HTML files with Chrome
- without other browsers/viewer
- without rooting the Android device
but maybe only until the next update :)
Total beginner here, when I create an HTML document (on NotePad) and then save it on my desktop, its icon switches automatically to a Chrome icon, which can only be opened as the Web page and not the code, or at least that is what I am observing. Can anyone show me how to reopen the page code ?
As a recent Mac OS adopter I too ran into this. For me, it was due to using TextEdit, and expecting it to act like Notepad.
When you save a .html file in TextEdit, it encodes the HTML and wraps it for you, without any notification.
Viewing source, or opening the file in vim or more in terminal shows what has been applied:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1265">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica; min-height: 16.0px}
</style>
</head>
<body>
<p class="p1"><!DOCTYPE html></p>
<p class="p1"><html></p>
<p class="p1"><head></p>
<p class="p1"><title>Test</title></p>
<p class="p1"></head></p>
<p class="p1"><body></p>
<p class="p2"><br></p>
<p class="p1"></body></p>
<p class="p1"></html></p>
</body>
</html>
I copied and pasted your code into textmate saved the file as test.html and doubled clicked on it.
It worked perfectly. It seems like a browser issue, have you tried reinstalling them. How about try it on another computer? Is the file name end with .html?
how about
<html>
<head>
<title>Hi</title>
</head>
<body>
<p>Are you working?</p>
</body>
</html>
does that work?