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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:55:50+00:00 2026-06-14T04:55:50+00:00

I am trying to make a tumblr app. When I make a get request

  • 0

I am trying to make a tumblr app. When I make a get request for any post, they come back with html for the body. Currently I am take the html and shove it into a uiwebview. I set the width of the view because it is always the same but I cant figure out how to calculate the height of it. I am trying to place this into a uitable, so i need to figure out the height for each cell.

So basically is it possible to get the height of the uiwebview after it has render the html?

  • 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-14T04:55:51+00:00Added an answer on June 14, 2026 at 4:55 am

    I use a javascript trick to do this.

    Before loading the HTML String into the UIWebView, you need to add the following javascript into the HTML String.

    NSMutableString *javaScript = [[NSMutableString alloc] init];
    [javaScript appendString:@"<script type=\"text/javascript\">"];
    [javaScript appendString:@"  window.onload = function() {"];
    [javaScript appendString:@"    window.location.href = \"ready://\" + document.body.offsetHeight;"];
    [javaScript appendString:@"  }"];
    [javaScript appendString:@"</script>"];
    

    This javascript will be triggered when the UIWebView has finished rendering and knew the required UIWebView height to show the entire content without scrolling up and down. The height is given by javascript variable document.body.offsetHeight

    The javascript will navigate UIWebView to a url scheme ready://

    The value of document.body.offsetHeight is stored as the “host”

    You have to intercept this request using the UIWebView delegate so that UIWebView does not navigate to ready://

    - (BOOL)webView:(UIWebView*)webView
    shouldStartLoadWithRequest:(NSURLRequest*)request
     navigationType:(UIWebViewNavigationType)navigationType {
    
        NSURL *url = [request URL];
        if (navigationType == UIWebViewNavigationTypeOther) {
            if ([[url scheme] isEqualToString:@"ready"]) {
    
                float contentHeight = [[url host] floatValue];
                NSLog(@"web height:%f",contentHeight);
    
                //You can use the contentHeight to resize the UIWebView frame
    
    
    
                return NO; //Prevent the UIWebView to navigate to this ready:// scheme
            }
        }
        return YES;
    }
    

    “ready” scheme is just an arbitrary name. Basically the UIWebView is asked by the JavaScript to navigate to ready://234

    “ready” is the custom URL scheme

    “234” is an example of the UIWebView required height to render the content of HTML without scrolling.

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

Sidebar

Related Questions

I am trying make a request and get response from server. Here is my
I'm trying to make my tumblr posts link directly to the source when clicked
I am fairly new to iOS development and trying make a simple app which
Trying to make a small countdown timer in my app but it's not working.
I'm trying make my first python app. I want make simple email sender form.
Trying to make td elements clickable. Here's my HTML: <td id=A3 class= open-square><a href=/gameplay/A3></a></td>
I'm testing out my CSS at http://flexibletheme.tumblr.com/ and trying to make the website responsive
trying to make an iPhone app and going through the tutorials and books recommended
i'm trying make simple app twitter and i use twitter4j library and i got
Trying to make a sliding panel where you can click next and back to

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.