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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:58:11+00:00 2026-06-14T15:58:11+00:00

I want to download html content, then find out it’s size (by calling javascript

  • 0

I want to download html content, then find out it’s size (by calling javascript functions). After that I want to change UIWebView frame to that size. And html content should fill whole UIWebView.

I read documentation and similar questions here on stackoverflow. Nothing helped. I don’t want to call reload method and download HTML from server twice. I get correct width and height of html, but after changing UIWebView frame size, html content doesn’t fill the frame. (this code below is called in - (void)webViewDidFinishLoad:(UIWebView *)webView)

NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
[f setNumberStyle:NSNumberFormatterDecimalStyle];
NSNumber *width = [f numberFromString:[self.mediaWebView stringByEvaluatingJavaScriptFromString:@"getContentWidth()"]];
NSNumber *height = [f numberFromString:[self.mediaWebView stringByEvaluatingJavaScriptFromString:@"getContentHeight()"]];

self.mediaWebView.frame = CGRectMake(BORDER_WIDTH, BORDER_WIDTH, _frameWidth, _frameHeight);
self.mediaWebView.bounds = CGRectMake(0, 0, _frameWidth, _frameHeight);

Init code:

self.mediaWebView = [[UIWebView alloc] initWithFrame:CGRectMake(BORDER_WIDTH, BORDER_WIDTH, _frameWidth, _frameHeight)];
[self.mediaWebView setBackgroundColor:[UIColor clearColor]];
[self.mediaWebView setOpaque:FALSE];
[self.mediaWebView setUserInteractionEnabled:TRUE];
self.mediaWebView.scrollView.scrollEnabled = FALSE;
self.mediaWebView.scrollView.bounces = FALSE;
self.mediaWebView.delegate = self;
self.mediaWebView.contentMode = UIViewContentModeRedraw;
self.mediaWebView.backgroundColor = [UIColor blackColor];


NSString *stringUrl = @""// some URL

NSURL *url = [NSURL URLWithString:stringUrl];
[self.mediaWebView loadHTMLString:[self.questionView.question.mediaHtml description] baseURL:url];

self.mediaWebView.scalesPageToFit = TRUE;

[self addSubview:self.mediaWebView];
  • 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-14T15:58:12+00:00Added an answer on June 14, 2026 at 3:58 pm

    As I described in comment below question. It was enaugh to set scalesPageToFit to FALSE

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

Sidebar

Related Questions

I have an HTML page that contains some filenames that i want to download
I want my script to download only text/html content and not binary or images
I want to allow a user to download an html file using a php
what I want: Download a webpage from a server > Save content in a
I want to download this picture using Ruby. How do I do that? http://farm1.static.flickr.com/92/218926700_ecedc5fef7_o.jpg
I want to download all files (html, images, js, css) from one website. I
I try to get HTML content, everything works find except 1 thing. It doesn't
I want download( cilk branch of gcc ) to build it with my gcc-4.7.
I want to download a video from the internet in my application. Hence, I
I want to download a single frame of a video file from a server

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.