• Twitter

So you’re making a Windows 8 App and using the WebView control but can’t figure out how to get the title of the webpage you’re requesting? Well, don’t feel bad because it’s not very obvious on how to do it, in fact you’re going to have to use a little JavaScript to figure it out (or just use my code).

public AppName()
Browser.LoadCompleted += Browser_LoadCompleted;
Browser.Navigate(new Uri(“http://www.bing.com”,UriKind.Absolute));

void Browser_LoadCompleted(object sender, NavigationEventArgs e)
string html = oauthy.InvokeScript(“eval”, new string[] { “document.title;” }); // This is where we will sift to get the “Document” Title
MyTextBlock.Text = html; // Output the Page Title to a TextBlock for Viewing

Now, if you wanted to find out if you’re at the Bing Images page (since Bing is the address used in the example), simply run a code like:

if(html.Contains(“Bing Images”)) // This is in the Title when you visit Bing Images, we’re seeing if it exists.
TextBlockBingIMG.Text = “Yes”; // We’ll tell our TextBlock the Result, meaning it’s true, we’re at a Bing Image page.

That’s all you have to do to get the Web Page Title and to see if the Page Title has a specific string (e.g. Bing Images) of the address you’re requesting…


Leave a Reply

You must be logged in to post a comment.

Sponsored by


My Windows Phone 7/8 App's (Many Not Updated)

waitlist (Free) for WP8 Health Center (Free) for WP8 Speechy (Free) for WP7 TWiT (Free) for WP7 Space Weight (Free) for WP7 I.T. Guy (Free) for WP7 Job Discovery (Free) for WP7 Spelling Bee (Free) for WP7 Coin Toss Up (Free) for WP7 BIG Dialer (Free) for WP7

MY Windows 8 App's (Many Not Updated)

MyTube (Free) for Windows 8/RT

  • Member of The Internet Defense League