Answered by:
How to get a html page?

Question
-
Hey,
sorry for this simple question.
I want to get the html content of a page as Platform::String^ .
Hope you can help me. Maybe with a link or an example code.
i managed it in a console application. But now i want it in metro style.Hope you can help me :)
Best RegardsSunday, August 26, 2012 8:42 PM
Answers
-
Hello,
As far as I know, there is no directly way to get the HTML source of WebView control. But the WebView can inject the script and get the result.
Therefore, we can inject script in WsbView loadCompleted event.
Please follow this sample code
http://code.msdn.microsoft.com/windowsapps/XAML-WebView-control-sample-58ad63f7In scenarion1, SDKSample::WebViewControl::Scenario1::WebView1_LoadCompleted function.
Add these codes
Array<String^>^ strarr=ref new Array<String^>(1);
strarr[0]="document.documentElement.outerHTML;";
String^ html=WebView1->InvokeScript("eval",strarr);
Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Jesse Jiang Thursday, August 30, 2012 6:12 AM
Monday, August 27, 2012 8:24 AM
All replies
-
Hello,
As far as I know, there is no directly way to get the HTML source of WebView control. But the WebView can inject the script and get the result.
Therefore, we can inject script in WsbView loadCompleted event.
Please follow this sample code
http://code.msdn.microsoft.com/windowsapps/XAML-WebView-control-sample-58ad63f7In scenarion1, SDKSample::WebViewControl::Scenario1::WebView1_LoadCompleted function.
Add these codes
Array<String^>^ strarr=ref new Array<String^>(1);
strarr[0]="document.documentElement.outerHTML;";
String^ html=WebView1->InvokeScript("eval",strarr);
Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
- Marked as answer by Jesse Jiang Thursday, August 30, 2012 6:12 AM
Monday, August 27, 2012 8:24 AM -
New in Windows 8.1: the Windows.Web.Http HttpClient API. This is an easy-to-use, full-featured HTTP API that works in all languages: C++, .NET (C#, VB) and JavaScript. Advantages of the new API include: strongly typed headers (meaning: you write fewer bugs in less time), full support for standard WinRT async concepts and data types.
HttpClient also lets you inject your modular filter code into the HTTP processing pipeline, letting you handle logging, testing, retry and auth more naturally. Samples of filters include retry and metered network filters in the HttpClient sample, and OAUTH and OAUTH 2.0 support in the Web Authentication Broker sample.
(Note that the existing IXHR2 code is still available for developers, and your existing Windows 8 code should continue to work as expected)
There's a //build/ 2013 video for the new API at http://channel9.msdn.com/Events/Build/2013/4-092
We also have samples at http://code.msdn.microsoft.com/windowsapps/HttpClient-sample-55700664
There's an OAUTH 0 filter sample at http://code.msdn.microsoft.com/windowsapps/Web-Authentication-d0485122
And there's documentation at http://msdn.microsoft.com/en-us/library/windows/apps/windows.web.http.aspx
Network Developer Experience Team (Microsoft)
Tuesday, July 16, 2013 9:31 PM