问题
I am trying to open a page using
UIApplication.sharedApplication.openURL(url)
I do few clicks and then it opens another page. I want to read that html body/content of newly opened page. How do I go about it?
Is there any other way to open a browser (in built browser and not UIWebview) and do the same?
Edit :
Say, I am opening google
UIApplication.sharedApplication.openURL(new NSUrl("www.google.com"));
I search for apple and it shows the results. Now I click wikipedia and it opens a page ie., wikipedia page for apple.
How do i get the html content of that wikipedia apple page? is there a way?
解决方法
In iOS you won't be able to do that.
I could do this easily using a WebView inside a ViewController.
public override void ViewDidLoad()
{
base.ViewDidLoad();
webView.LoadRequest(new NSUrlRequest(new NSUrl("https://xamarin.com")));
webView.LoadFinished += (sender, e) =>
{
if (webView.IsLoading)
{
return;
}
var html = webView.EvaluateJavascript("document.documentElement.outerHTML");
};
}