how can i read cookie generated by web browser from activex control

风格不统一 提交于 2019-12-11 06:48:31

问题


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:


What you can do is

1) hook up Web Browser events, using for example this sample How to sink HTML document events for WebBrowser host

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);

More on this here: Handling HTML Element Events

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



来源:https://stackoverflow.com/questions/16767130/how-can-i-read-cookie-generated-by-web-browser-from-activex-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!