Connecting Tech Pros Worldwide Forums | Help | Site Map

How to simulate JavaScript in a client Applications

Newbie
 
Join Date: May 2009
Posts: 2
#1: May 27 '09
Hi Guys.
I'm writing a web crawler (web spider) that crawl all links in a website.
My application is a Win32 App, written in C# with .Net framework 3.5.
Now I'm using HttpWebRequest an HttpWebResponse to communicate with the web server.
I also built my own Http Parser that can parse anything I want.
I found all link like "href", "src", "action"... in the parse.
But I can not solve one problem: Simulate Client Script in the page (like JS and VBS)
For example, if a link like:
<a href="javascript:buildLink(1)"> ... with buildLink(parameter) is a Javascript function that will make a custom link due to the parameter.

Please help me to solve this problem. How to simulate JavaScript in this app? I can parse the HTML source code and take all JavaScript code to another file, but how to simulate a function of it?
Thanks.

Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,137
#2: May 27 '09

re: How to simulate JavaScript in a client Applications


Well first you're going to have to understand what the JavaScript function does and then translate that into C# code that your application can execute....

It sounds like your application is going to have to translate JavaScript into C#...this is not going to be an easy task and you are going to have to know how JavaScript works so that you can implement an application that knows how to translate it.

Good luck,

-Frinny
Familiar Sight
 
Join Date: Dec 2008
Posts: 202
#3: May 29 '09

re: How to simulate JavaScript in a client Applications


Are you going to build a compiler?
Newbie
 
Join Date: May 2009
Posts: 2
#4: May 30 '09

re: How to simulate JavaScript in a client Applications


I want to build a crawler, so that I must do anything as a browser can do, but how to?
Familiar Sight
 
Join Date: Dec 2008
Posts: 202
#5: May 30 '09

re: How to simulate JavaScript in a client Applications


If you are going to build it from scratch it's not an easy task. I've a compiler exam tomorrow, not easy at all. Look for libraries you can use ActiveX component, I didn't before, or It will take a long time for "simulating".

Regards,
Bassem
Reply

Tags
javascript simulate


Similar .NET Framework bytes