By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

How to simulate JavaScript in a client Applications

P: 2
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.
May 27 '09 #1
Share this Question
Share on Google+
4 Replies


Frinavale
Expert Mod 5K+
P: 9,731
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
May 27 '09 #2

100+
P: 344
Are you going to build a compiler?
May 29 '09 #3

P: 2
I want to build a crawler, so that I must do anything as a browser can do, but how to?
May 30 '09 #4

100+
P: 344
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
May 30 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.