How to validate an ActiveX Code as HTML5?

2019-08-21 19:36发布

问题:

I know ... ActiveX ... blarghhh!

the normal code for using an OCX Object in HTML is:

<object id="ActiveX" 
        classid="CLSID:DF3748A3-7F0B-47E9-BB32-233E591CAD65" 
        width="140" height="140" 
        codebase="http://domain.com/ActiveX.cab#version=1,0,0,0">
</object>

but HTML5 docs states that codebase and classid are no longer supported and that I should use data and type instead...

I can get that the data will hold the path to the cab file, but where do I stick the classid ?

<!-- OCX -->
<object id="ActiveX" 
        classid="CLSID:DF3748A3-7F0B-47E9-BB32-233E591CAD65" 
        width="140" height="140"
        data="http://domain.com/ActiveX.cab#version=1,0,0,0" 
        type="application/octet-stream">
</object>

works, but because I still have classid is still not a valid document :-/

回答1:

You can add a registry key that will map a mimetype to a CLSID and then you can just use the type="" attribute.

For more info, see http://msdn.microsoft.com/en-us/library/aa751976%28v=vs.85%29.aspx