1

I'm writing an ios app that uses a UIWebView to display local html content as a help subsystem. The user can follow links to other local html content and I want to be able to tell what page the UIWebView is currently displaying.

I have tried webView.request.URL.absoluteString and similar variants but it gives me the app bundle and not the local html file within. How can I get the name of the local file being accessed?

AntonDelprado
  • 817
  • 2
  • 8
  • 10

1 Answers1

1

try this

assuming your html file resides in your bundle.

[WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Your_File_Name" ofType:@"html"]isDirectory:NO]]];

hope to be helpful to you.

HarshIT
  • 4,583
  • 2
  • 30
  • 60
  • Just to clarify: I am loading the pages with no problem. When a user follows links I want to keep track of what page they are currently viewing. – AntonDelprado Jan 30 '12 at 12:16
  • Ok , try reading this link, may be helpful to you http://stackoverflow.com/questions/4679378/iphone-uiwebview-get-the-url-of-the-link-clicked – HarshIT Jan 30 '12 at 13:02
  • In that link they are using `webView.request.URL.absoluteString` which as I've said I've tried. I assume they are using web addresses and the problem occurs with locally loaded html files. – AntonDelprado Jan 30 '12 at 22:55