1

I have a Subview that load a Webview. In this Webview I load a file HTML locally in the Documents folder of my App. I need to check if the webview load another HTML file. Specifically:

  1. Webview load "index.html" locally in my Documents folder
  2. After 7 days a Javascript load another page with location.href= "index2.html",
  3. When I load this WebView I need to check if the current URL is index.html or index2.html, if is the second I must change Subview!

How can I do this?

3 Answers 3

6
NSString *currentUrl = [[[yourWebView request] URL] absoluteString];
Sign up to request clarification or add additional context in comments.

Comments

1

Use this NSURL method [NSURL fileURLWithPath:@"some/path/to/your/file" isDirectory:NO] and pass that to a NSURLRequest which is then passed to your UIWebView. You can get the path to your resource by using the [[NSBundle mainBundle] pathForResource...] methods.

Comments

0
NSURL *url = myWebView.request.URL;

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.