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 8473317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:19:01+00:00 2026-06-10T17:19:01+00:00

I have some embedded html in my application bundle.I’m using loadHtmlString to load it.

  • 0

I have some embedded html in my application bundle.I’m using loadHtmlString to load it. At the same time there are some image files in my documents folder.I want to replace my img in html with the one in my documents folder. For example, here is the sample html I have:

       <div id="image">
            <a href="image">
                <img src="@image" class="center">               
            </a>
        </div>

I’m using the following code to replace the @image to the file path in my documents:

    NSString* imgFile = [NSString stringWithFormat:@"file:///%@/%@",
                         [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Images"],@"myimage.png"];
    text = [text stringByReplacingOccurrencesOfString:@"@image" withString:imgFile];   

    NSURL* baseUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath]];
    [self.webView loadHTMLString:text baseURL:baseUrl];    

(text is the html text of my html file).

It works the first time when this code is called. But for example, if I modify myimage.png and call the code again, the image before I modified is still showed. (I have check my file in my document folder, it’s already modified correctly).

I suspect it’s caused by the cache. Can anybody advise?

Thanks

Note:

It is caused by the cache. I solved the problem by using the following method to force UIWebView to load a fresh copy of image:

NSString* imgFile = [NSString stringWithFormat:@"file:///%@/%@?t=%d",
                         [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Images"],@"myimage.png",time(NULL)];
    text = [text stringByReplacingOccurrencesOfString:@"@image" withString:imgFile];
  • 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-06-10T17:19:02+00:00Added an answer on June 10, 2026 at 5:19 pm

    I solved the problem by add a time in my url. So the image will not be cached. Please refer to my questions. The question is consider to be closed.

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

Sidebar

Related Questions

I have an application that requires to use QWebView::setContent() to load some HTML content
I have seen some mails which has HTML content embedded in them. The content
I have some Flash swfs that are embedded using swfobject and I pass them
I have an application on the Compact Framework that has some large embedded resources
Here goes: I have an application that does some processing, writes some result files
I see some tweets have some kind of HTML embedded. How is it possible
If I have a HTML form with some embedded div s, and after the
I am having troubles sending email with embedded image. I tried some solutions using
I've got some embedded (read: local) html files with forms loaded in a UIWebView
Recently I've been working on some embedded devices, where we have some structs and

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.