有关如何从NSString或NSURL获取网站根目录的任何想法?所以,如果我的网址是 http://www.foo.com/bar/baragain,我将如何获得http://www.foo.com/?
我想使用javascript来检查UIWebView中是否存在类.这是我到目前为止:
NSString* checkForWaldoCmd = [[NSString alloc] initWithString:@"document.getElementsByClassName('waldo');"];
NSString* wheresWaldo = [myUIWebView stringByEvaluatingJavaScriptFromString:checkForWaldoCmd];
Run Code Online (Sandbox Code Playgroud)
我基本上想要检查页面中是否存在"waldo"类.当我运行上面的代码时,无论类是否存在,我都会得到一个空白字符串.有什么建议?