Open .html file on iOS device
I could see that your aim is to make IPA download on clicking specific link.
What I did was, created new repository over GitHub and uploaded index.html over there.
Then I followed steps mentioned here
Steps to host on Github.
- Create a new project.
- Add index.html as we will be hosting a site in
Github Pages. Note html file with other name will not be valid as it
should always be with index name. - Now go to project settings. Traverse through Github Pages
- Under source tab select master-branch and click on save
- Traverse back Github Pages you will see site will be published
It will show the html page as desired.
How to open a local HTML file in Safari on an iPad
Safari iPad no longer supports access to local or iCloud files. A number of iPadOS apps will however allow a user to view, edit, and test html code in files stored in local iPad, iCloud, or third party (e.g. Google or Dropbox) storage folders. One needs only to search in the App Store for “html editor” to see the list. Some of the apps have features that rival or exceed those found in tools on desktop (laptop) systems.
How can I view my offline/local HTML file on iPad?
Edge Browser App worked.
I some how assumed that the Edge Browser App will not do more than the Chrome Browser App (since Edge is based on Chromium). But i was wrong. From all i tried (Chrome, Safari, Firefox, Goodreader and many more), Edge was the only thing that worked.
Go to file, chose open with different App, chose more, chose Edge, wait for quiet a bit, and it shows.
iOS UIWebview Load local device HTML file path
use this code to achieve what you want
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"SarkBuilerHtmlFile_new" ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlString baseURL:nil];
but for this make sure your html file must be within your app folder in xcode
Edits:-
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"txtFile.txt"];
NSString *content = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
NSString* htmlString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlString baseURL:nil];
OR
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"txtFile.txt"];
NSString *content = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
NSString* htmlString = [NSString stringWithContentsOfFile:content encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlString baseURL:nil];
How to open an HTML project on the iPad
2016 UPDATE:
There are several services which now make this easy. If you don't have your own web server check out one of these free services which make updating a live webpage from your PC easy:
Heroku
Git Pages
Both of these services require using git, learn it, you won't regret it.
Days of FTPing or using Dropbox to serve html to an iPad are long gone.
If you need to be able to do this while not connected to the internet check out this article on using local IP tunneling. This would essentially open up the localhost
on your PC to be viewed by anyone on a wifi network, regardless of if the wifi was actually connected to the Internet.
http://wesbos.com/localhost-mobile-device-testing/
I prefer Heroku as I am more likely to be switching between locations and PC's than I am to be on a wifi network without an Internet connection.
OLD ANSWER 2012
Get a Dropbox account and put the project in your public folder.
Right click to get the public link and then browse to that location on your iPad.
When I get link from the iPad app it doesn't work it just shows the raw html with a URL structure like so
dropbox.com/s/...
When I go to the website and copy public link (only available if the file is in PUBLIC FOLDER) I get the link that actually works.
Related Topics
How to Deal With the Nsdateformatter Locale "Feechur"
How to Add Exception Breakpoint in Xcode
How to Develop For Iphone Using a Windows Development Machine
Uidevice Uniqueidentifier Deprecated - What to Do Now
How to Load an Http Url With App Transport Security Enabled in iOS 9
What's the Difference Between the Atomic and Nonatomic Attributes
How to Embed a Custom Font in an Iphone Application
Presenting Modal in iOS 13 Fullscreen
How to Associate File Types With an Iphone Application
How to Force Nslocalizedstring to Use a Specific Language
How to Pass Prepareforsegue: an Object
How to Change Status Bar Text Color in Ios
Determine Device (Iphone, Ipod Touch) With Ios
How to Determine the Current Iphone/Device Model
Test iOS App on Device Without Apple Developer Program or Jailbreak