Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5965021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:32:18+00:00 2026-05-22T19:32:18+00:00

Edit: So the answer was in this post: Loading javascript into a UIWebView from

  • 0

Edit:

So the answer was in this post: Loading javascript into a UIWebView from resources

You’ll find everything you need to know for loading an HTML5 app with directories there, just make sure you drop files on your Xcode project clicking the radio button that reads “Create folder references for any added folders”. Then just use the code on that links I’ve added up there.

Thanks to Sergio for the help.


I’ve been through StackOverflow several times already and none of the code I find there can display the images of my html5 App. The hard part seems to be loading files from different subdirectories. I do not want to throw everything in the root and then use the groups in Xcode because I would have to re-factor a lot of the HTML5 code.

I’d like to build this in as a light container, not have to use PhoneGap. Besides PhoneGap comes with a bigger bagage of bugs (I tested our app and it crashed on the iPad and worked on the iPhone). It’s hard enough to deal with the HTML5 side of things and Cocoa Touch.

So here’s how I load the HTML page:

[webView loadRequest:[NSURLRequest requestWithURL:
       [NSURL fileURLWithPath:[[NSBundle mainBundle] 
       pathForResource:@"index" ofType:@"html"]isDirectory:NO]]]; 

I have found some solution that it’s getting me closer to “Create folder references for any added folders” when adding the files to the resources folder, I can now see some of the images being loaded. The JS doesn’t seem to be working properly. I have tested this app loading it from a URL running on a local server and it does work in that case.

So CSS is obviously working, images too but JS seems to be an issue.

Hopefully I’ll find the answer soon.


Old

(this is when I was including the folders the wrong way)

So as you guys don’t have to be wondering what am I seeing ( it looks to me like js and images are not loading and I do have subdirectories on the HTML5 app ):

enter image description here


Interesting posts which are related to this:

Loading javascript into a UIWebView from resources
Link to resources inside WebView – iPhone

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:32:19+00:00Added an answer on May 22, 2026 at 7:32 pm

    Indeed, you can load a local HTML in a UIWebView by means of:

    – loadHTMLString:baseURL:
    

    The only thing you should be aware of is how to specify the baseURL so that it goes to your local resources directory. So, if you add in your HTML:

    <img src="localImage.png" />
    <link rel="stylesheet" type="text/css" href="theme.css" />
    <script type="text/javascript" src="filename.js"></script>
    

    this will be found among your project resources.

    It definitely works. Possibly there is some “issue” with your HTML and javascript source (like, e.g., using subdirectories or absolute URLs).

    EDIT:

    If you need to organize your resources (images and scripts) in directories inside of the Resources directory of your app, see this S.O. topic.

    To get the path to your Resources directory, use:

     NSString* filePath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];  
    

    An alternative could be hosting all of your file in the Documents directory of your app (which is reserved for user content). In this case, I suppose you could download an archive of your app and install it in the document directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
This post asks how to convert from bazaar to svn. I need to do
Edit: I have solved this by myself. See my answer below I have set
Is there a way to convert from System.Windows.Forms.HtmlElement to mshtml.IHTMLElemenet3? --edit after answer accepted
Edit: From another question I provided an answer that has links to a lot
I've been trying to find an answer to this, and can't seem to. What's
EDIT: The issue underneath is fixed, GO TO EDIT2 in this post. I have
Ok, I know the answer for this question may not be objective but I
I recently learned about strides in the answer to this post , and was
I'm stumped. Why wouldn't the first and fourth lines evaluate to null? Post-answer edit:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.