我如何从ActiveX控件中读取Web浏览器生成的Cookie [英] how can i read cookie generated by web browser from activex control

查看:182
本文介绍了我如何从ActiveX控件中读取Web浏览器生成的Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Activex控件读取并获取Web浏览器生成的cookie的内容。我不想从javascript读取cookie并将其传递给activex控件。我想直接从activex控件读取cookie。如果可能的话,建议我使用该API,同样,我也必须使用NPAPI实现相同的功能(因此请在此处建议使用API​​)。因此,期待一些积极的答案。

I want to read and fetch the contents of a cookie generated by web browser from activex control. I dont want to read the cookie from javascript and pass it to activex control. I want read the cookie directly from activex control. If it is possible then suggest me the APIs for that and also same thing I have to achieve using NPAPI also (so please suggest APIs in here also). So looking forward for some positive answers.

推荐答案

您可以做的是

1)使用此示例如何为WebBrowser主机接收HTML文档事件,从而连接Web浏览器事件

2)一旦您掌握了已加载的 IHTMLDocument2 文档接口,只需读取cookie属性的值即可:

2) once you get a hold on the loaded IHTMLDocument2 document interface, just read the value of the cookie property:

CComPtr<IHTMLDocument2> pDoc // get document from event as shown in the sample.

// read the cookie
CComBSTR cookie;
hr = pDoc->get_cookie(&cookie);

此处的更多信息:处理HTML元素事件

注意:对于NSAPI,建议您与其他人一起写另一个问题标签,因为这是一个完全不同的世界。

Note: for NSAPI I suggest you write another question with other tags as this is a totally different world.

这篇关于我如何从ActiveX控件中读取Web浏览器生成的Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆