سؤال

I have created a custom file type for my application. When the user attempts to download a file of this custom type in IE, I would like to be able to detect the download and take action . So far, I have started to write a BHO using C#, in hopes of being able to detect the download. Unfortunately, I have not yet determined what event I should use (perhaps OnDocumentComplete) and which objects and properties to examine to determine that my file type has been encountered. How can I detect the download of my file type in IE so that I can take action?

هل كانت مفيدة؟

المحلول

Instead of using a BHO, the proper extension for this sort of task is a MIME Handler. See http://msdn.microsoft.com/en-us/library/aa767916(v=vs.85).aspx for details on this topic.

Having said that, all IE extensions (and URLMon pluggable extensions in particular) are EXTREMELY difficult to write properly and as a consequence are a frequent source of security holes and reliability bugs. They also don't work in other browsers, and don't work in the "Metro" mode of IE10+ on Windows 8+.

Rather than going the browser extension route, you would be FAR better off just registering your MIME type/file extension in the Windows Registry and having that invoke your application. This is stable and works across all browsers and in all modes.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top