UIWebview in iOS 6 - To load the content using loadData method

235 views Asked by At

I have tried to load the content(docx,xlxx,.m,.h and etc except images&pdf) in iOS6-UIWebview using the loadData method. The content is not loading.

Incase use the loadRequest , content is getting loaded. But, The loadData method is working fine iOS 7 and above.

I am sending the mime type is correctly.

Kindly clarify me, is it possible to load the content in UIWebview using loadData method in iOS 6?

Thanks in advance.

1

There are 1 answers

0
Ramesh On

Use this code for document viewing in webView

NSURL *url = [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:@"{File Name}" ofType:@"{file Type}"]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[self.view addSubview:webView];