A aatif macrumors newbie Original poster May 26, 2008 10 0 Jun 2, 2008 #1 hello, Is there any way to get the source code of the webpage that is being displayed by the webview? Assume that I've provided the URL of this page.
hello, Is there any way to get the source code of the webpage that is being displayed by the webview? Assume that I've provided the URL of this page.
robbieduncan Moderator emeritus Jul 24, 2002 25,611 893 Harrogate Jun 2, 2008 #2 aatif said: hello, Is there any way to get the source code of the webpage that is being displayed by the webview? Assume that I've provided the URL of this page. Click to expand... Yes, it's all in the documentation. Also it's very bad form to tag a question onto someone else's thread. Instead of hijacking their thread start your own. The following will get the source code as part of a web frame load delegate: Code: - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { if (frame == [sender mainFrame] || [frame parentFrame]==nil) { source = [[[[[webView mainFrame] dataSource] representation] documentSource] retain]; } } Note that I only want the source from the main frame of the webview and check that this is the case.
aatif said: hello, Is there any way to get the source code of the webpage that is being displayed by the webview? Assume that I've provided the URL of this page. Click to expand... Yes, it's all in the documentation. Also it's very bad form to tag a question onto someone else's thread. Instead of hijacking their thread start your own. The following will get the source code as part of a web frame load delegate: Code: - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { if (frame == [sender mainFrame] || [frame parentFrame]==nil) { source = [[[[[webView mainFrame] dataSource] representation] documentSource] retain]; } } Note that I only want the source from the main frame of the webview and check that this is the case.
A aatif macrumors newbie Original poster May 26, 2008 10 0 Jun 3, 2008 #3 Thanx for ur help and guidance, however I got the solution as; Code: NSString *source = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"www.website.com"]];
Thanx for ur help and guidance, however I got the solution as; Code: NSString *source = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"www.website.com"]];