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

  • Home
  • SEARCH
  • 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 6815531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:49:07+00:00 2026-05-26T20:49:07+00:00

In my app I have a UIWebView-based view controller showing info and credits about

  • 0

In my app I have a UIWebView-based view controller showing info and credits about the app itself. As part of the info, the app version is displayed, as retrieved from the infoDictionary of the mainBundle. So this string is not in the original HTML; it is set programmatically, by replacing a placeholder.

Therefore the sequence is:
1) I load the HTML into a NSString
2) I replace the placeholder with the actual version
3) I show the resulting string in UIWebView by invoking method loadHTMLString:baseURL:

The HTML also has hyperlinks to some web pages in the internet.
Everything is fine, but for this problem:
If I touch a hyperlink, and therefore navigate to the corresponding web page, I will not be able to go back to my original info page (canGoBack returns NO, goBack does nothing).

Any suggestion?
Thanks in advance.

  • 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-26T20:49:08+00:00Added an answer on May 26, 2026 at 8:49 pm

    In the end, I have found a satisfactory solution, that I would like to share.

    1) I changed the HTML code of my info page, by inserting the following code where I want to show the app version:

    <p>App  version:
    <script type="text/javascript">
        var args = document.location.search.substring(1).split("&");
        for (var i in args) {
            var nameValue = args[i].split("=");
            if (nameValue[0] == "version")
                var version = nameValue[1];
        }
        if (version)
            document.write(version);
    </script>
    </p>
    

    This piece of code will parse the query part of the URL, looking for a “version=<version>” argument, and use its value to show the app version.

    2) When preparing the URL to be used by the UIWebView, I retrieve the app version from the main bundle:

    NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
    

    Then I append it at the end of my URL string:

    NSString* urlString = [NSString stringWithFormat:@"<my_info_page>.html?version=%@", version];
    

    3) Finally, I use the UIWebView to show the page:

    NSURL* url = [[NSURL alloc] initWithString:urlString];
    NSURLRequest* request [[NSURLRequest alloc] initWithUrl:url];
    [mWebView loadRequest:urlRequest];
    [urlRequest release];
    [url release];
    

    where mWebView is an IBOutlet, of type UIWebView, properly connected to the web view in the XIB file.

    It works correctly on my iPhone 4, including the back/forward functions of the web view when following hyperlinks, while keeping the user inside the app.

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

Sidebar

Related Questions

I have a UISplitView-based app with a UIWebVIew in the Detail View. I want
I'm writing a view based app, but I'm a bit confused about loading my
I have a UIWebView object declared in my view controller and I want to
in my app i have a UIWebView and in that web view i am
I have an UITabBar based iPhone app with 4 different UIWebViews under every tab.
I have a UIWebView in my app which I want to use to display
I have an app, where there's one UIWebView and a UITableView. I don't want
I have a simple app with a full screen UIWebView. This contains HTML generated
I have an iPad app. In the Root View I have a UITableView with
In my app I have a UIWebView which loads different rtf files. I use

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.