Have you ever wondered how to open a HTML file on the iOS platform? Well, wonder no more! In this article, we will be going over how to open your friend’s HTML files in their mobile website.
First of all, let me say that HTML documents can’t be opened from an iPhone defaultly when you use the .HTML file extension. The HTML5 standard isn’t supported by the iOS platform, but there are some workarounds that you can use to get it working properly.
How to open html file on iphone
Open your HTML file in a web browser for iPhone
First of all, if your HTML document is saved with another name than .HTML, then you will be able to access it through the default Safari web browser. It is important to use an specific name so that it will be recognized properly by the web browser you have open.
For example, if your HTML file is named hello.html then when you will try to open it in Safari, there won’t be any problem at all because you are opening a .HTML file. But if you try to open it with a name like myHTMLfile.html , Safari will only display the contents of your HTML file and not the website itself.
That is because Safari can’t find a web server running on your iPad or iPhone. To fix this issue, we need to setup a local web server using Python. Once we get the local web server running, we will be able to open HTML files saved with any name like .HTML.
Installing Python on you iPhone or iPad (command line)
To get this done, run Cydia on your iDevice and type in python in the search bar. Once you get the installation file downloaded for it, click install and wait for it to finish. After the installation process is done, restart your iDevice and re-open Cydia.
For more information on how to install a package using Cydia, check out our previous post here . If you can’t find Python when you run Cydia after installing it, type in http://python.org/ftp/python and download the latest version of Python in .deb format.
Once you have Python installed, we need to install a server for it so that we will be able to view HTML files with it. We are going to use nano text editor because it is really simple and easy to work with when editing files on your iOS device. That way, it is easier to learn how to open .html files on iPhone.
To install nano text editor, type in apt-get install nano in your iOS command line. Once the installation finishes, type in the following command to create a document with file extension of .nano :
sudo nano /var/www/ss64.com/ -B
You will get a new file named ssword64.com with the .nano file extension. This is the text document we need to open HTML files in this iOS platform. After that, type in the following command to run nano web server at port 80 (the default HTTP port)
sudo nano /var/www/ss64.com/ -B -P 80
This will start a web server on port 80 by using Python and nano text editor. You can close this document now because we are done with it.
That is all you need to know about how to open HTML files on iphone. You can now run your HTML file using Python web server by using the following command: http://localhost/hello.html
If you want to check if it works, open up Safari and go to localhost followed by the name of your .html file. If you succeeded, you should be able to open your HTML files on an iOS device.