2

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?

hyoyin_Kyuoma
  • 643
  • 1
  • 6
  • 16

1 Answers1

0

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");
    };
}
jzeferino
  • 7,700
  • 1
  • 39
  • 59
  • Thank you !! Can you tell me how to synchronise the loadfinished. For example, i have to return the html variable. It returns a null right now. How to wait for the loading to finish before returning it.? – hyoyin_Kyuoma Jun 17 '16 at 04:51
  • When you call the EvaluateJavascript the page has already loaded totally. You will get the full HTML. You don't need to synchronize. – jzeferino Jun 17 '16 at 08:08