c# - How to find out what "kind" of document is being displayed in IE -


I am using c # to create a button for IE and this button does some work which is used by all the documents Pdf document If there is no document PDF, but I'm not sure how the Adobe and Reader work on the hand in IE's hands, then I am trying to set up the guard to stop any kind of action. I've seen both the WebBrowserClass object using both SHDocWV and it's not sure how to find out. any suggestion?

This is a little problem to AFAIK

IWebBrowser2 :: Type < / Em> The value of the property depends on the plug-in that you have installed that PDF, because some plug-in creates HTML wrappers for PDF files (like Adobe) that you get in the form of an "HTML document" type And some plug-ins do not do this (such as fuxit), so you can not relay it specifically.

So if you've got a PDF with HTML wrapper, then use IHTMLDocument2 :: mimeType to find the exact type of document (JPEG / GIF / PNG / etc) browsers Are wrapped in HTML by). But as I know it is also incredible, for example, on my machine it gives "Firefox document" for HTML documents because .html files are connected to Firefox: but I did not test to see that Is it in the case of PDF Ales

Another option GetUrlCacheEntryInfoEx is the API call to get in the local browser cache, which stores the document Read it again (just beginning the file, I think only the first 256 bytes are important) and call FindMimeFromData with the data you just read and it will return the mime type .


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -