问题
I am implementing a pluggable protocol handler in my own browser application for the purpose of blocking ads. It's a namespace handler to be exact. I can easily get the url of the element being dowloaded from within the namespace handler. But I would like to get the URL of the page which contains the element as well. The browser app I am building hosts many web browser controls in a single process. At this moment, I don't know any way to tell which web browser control issues the download request.
Thanks a lot for any useful tips leading to the solution.
回答1:
Using GetBindString in iinternetprotocolroot start will give you the url of the page.
pIBindInfo->GetBindString(BINDSTRING_URL, .., .., ..);
来源:https://stackoverflow.com/questions/12717365/how-to-detect-the-main-page-url-from-within-a-pluggable-protocol-handler