//To get string from the title of the HTML page: NSString *currentURL = [theWebView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘title‘)[0][removed];"]; //To get string from class name: NSString *someHTML = [theWebView stringByEvaluatingJavaScriptFromString:@"document.getElementsByClassName(‘class name‘)[0][removed];"]; //To get string from element id: NSString *html = [theWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById(‘div id‘).textContent=‘‘"];
时间: 2024-11-06 23:16:11