开发者

How to run javascript function from external site C#

开发者 https://www.devze.com 2023-01-08 02:16 出处:网络
I would like to download an image from external site using C#. The problem is image\'s source is generated on the server side using ajax and is not available from source code of the page. The JavaScri

I would like to download an image from external site using C#. The problem is image's source is generated on the server side using ajax and is not available from source code of the page. The JavaScript function which is called to generate image's source looks like this:

xmlHttp.onreadystatechange=function()
  {
  if(xmlHttp.readyState==4)
    {
    document.searchform.xpic.src=xmlHttp.responseText;
    }
  }

xmlHttp is instanced earlier:

开发者_Python百科xmlHttp=new XMLHttpRequest();

So is it possible to initiate the call of JavaScript function and get source of the image? Could you please tell me how to do it?


You could inspect the URL by which the above request is made and replicate the same request from your C# code to get the URL of the images. Its much easier to go on about the problem this way than looking at executing JavaScript within the C# environment.

0

精彩评论

暂无评论...
验证码 换一张
取 消