Nick Zdunic
Nick Zdunic

Reputation: 33

Call Javascript function from Windows Phone 7/Silverlight

I want to authenticate to a an external web page from my windows phone application. I will then want to do further scraping of pages on the site but need to get past the authentication issue.

The page on the external website has a function call validateLogin which takes login name and password.

I want to call this function from my Windows Phone code passing in the required arguments. This would facilitate logging into the site and hopefully I can continue to scrape the pages.

Upvotes: 0

Views: 1202

Answers (1)

Derek Lakin
Derek Lakin

Reputation: 16319

Use the WebBrowser control and call the InvokeScript method. Ensure that you set IsScriptEnabled on the WebBrowser control and that you specify the ID_CAP_WEBBROWSERCOMPONENT capability in WMAppManifest.xml.

As a side note: Scraping web pages is rarely a robust and reliable approach of creating an application that uses a website :)

Upvotes: 1

Related Questions