3

I need to set the background of webView at a time when the html has not loaded.

In iOS 5.0 this code is correctly working:

- (void)viewDidLoad
{
    [super viewDidLoad];
    [webView stringByEvaluatingJavaScriptFromString:@"document.body.style.backgroundColor=\"#41414C\";"];
}

But in iOS 4.2 nothing happening with background.

How can I set background of web View at a time when the html has not loaded?

1
  • i am also using one local HTMLpage which contains javascript function. But when i load it more than 2 or 3 it gets memory warning.. Any one have idea ? Commented May 3, 2012 at 12:28

2 Answers 2

2

In my case I used webview:webViewDidFinishLoad method to evaluate javascript. It was working correctly in 4.2 but since I haven't tested it in iOS 5, I am not sure about its working in that version.

Sign up to request clarification or add additional context in comments.

Comments

1
  • hide the webview until it is not loaded and set a view behind it with your desired background-color.
  • when your webview is loaded, show it and set the background color of the html inside the webview

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.