Programs for MS Windows can associate some protocols with them. So when you click in browser, registered program for protocol "myprotocol" will be opened. Like "mailto:mail@mail.ru" opens your Email programm开发者_开发问答.
I have a website and want to know if visitor of my web site have registered some protocol in his system or not. So when he clicks on link and don't have protocol registered some page like "Please, install my programm". Otherwise registered program starts. How can I do this with javascript or avtiveX or something else?
I know how to do this for Firefox and Crome(Using "Location" header and iframe), but don't know how to do it for IE and Opera. Please help me.
I did this sort of thing once. What I did was, in the installer, I registered a MyProgram.IsInstalled
key in HKEY_CLASSES_ROOT with the same CLSID as Scripting.Dictionary. Then, in JavaScript, I tried to do a var isInstalled = new ActiveXObject("MyProgram.IsInstalled");
. If it worked, my program was installed (and I had a handy new Scripting.Dictionary instance that I promptly threw away). If it didn't, well, it wasn't.
Direct detection of arbitrary protocols in IE is not presently possible, because we keep cutting my proposed API for this. You currently have to use an ActiveX control for this purpose.
For specific protocols, you should just register your component with a version vector which can then be detected by conditional comments: http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx
精彩评论