DragonWar% 2015-05-02 08:13 采纳率: 0%
浏览 27

C#/。NET中的网站“主管”

I'm not sure what the technical name for what I'm looking for is, but this is what I'm trying to achieve:

I need to write a "client" for a specific website which uses Ajax/XHR for communication with the server.

My approach is to make a custom web browser that will run the JavaScript in the background, and I can show all the relevant information to the user. My first thought was to use hidden WebBrowser, however I'm not sure if it can achieve all the following:

  • Denying requests (so that unnecessary content doesn't load)
  • Inspecting (and possibly editing) XHR requests and responses
  • Making custom JavaScript calls (using javascript: quasi-protocol is ok)
  • Inspecting HTML elements' event listeners (so that I can call them)

Basically, I want functionality similar to that of Chrome's Developer Tools, in C#.

What's the easiest way of doing so, since my current idea is to use WebBrowser through a custom proxy, with hardcoded event listeners (manually found, hoping names don't change soon)?

  • 写回答

1条回答 默认 最新

  • weixin_33728708 2015-05-02 08:43
    关注

    If you truly want to use C# and Chrome, go for CefSharp:

    which is bindings for .NET and Chromium browser.

    I think it could be a lot easier to use Electron or nw.js, but these would require you code in javascript, which of cause also will make custom javascript calls easier.

    Side note: The new Visual Studio Code is actually built with Electron, so even microsoft uses that for doing javascript/web technology based apps.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀