Call Javascript function from Windows Phone 7/Silverlight

1.2k views Asked by At

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.

1

There are 1 answers

2
Derek Lakin On

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 :)