Hi guys, I have this question that is unsolved for me.... I need to check if the current URL of my webview is a local file in the Documents directory of my app....how can I do this??
Thanks!
Hi guys, I have this question that is unsolved for me.... I need to check if the current URL of my webview is a local file in the Documents directory of my app....how can I do this??
Thanks!
Check the URL's scheme. Assuming you have an NSURL*
instance called myURL
:
if ([[myURL scheme] isEqualToString:@"file"]) {
NSLog(@"URL %@ is local", myURL);
}
Read Apple's NSURL
specification to learn more about accessing different parts of an URL.
Assuming you have a UIWebView*
called myWebView
, you might call something like:
[[myWebView request] URL]
to get the NSURL*
of what the web view currently has loaded. Then you can call that object's scheme
as described above.