Skip to content

Instantly share code, notes, and snippets.

@syshack
Created December 30, 2015 02:23
Show Gist options
  • Select an option

  • Save syshack/169aa7a4cce0fc26dc87 to your computer and use it in GitHub Desktop.

Select an option

Save syshack/169aa7a4cce0fc26dc87 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>MyHtml.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<textarea id="sPKCS7" rows="6" cols="50">-----BEGIN CERTIFICATE-----
MIICQTCCAaq ** 证书内容 **/wpUHBs8=
-----END CERTIFICATE-----</textarea><br>
<object id="objCertEnrollClassFactory" classid="clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"></object>
<noscript>浏览器不支持Javascript或者是您的安全设置不允许Javascript运行,请调整您的浏览器设置!</noscript>
<script type="text/javascript">
function installCertForWin7(){
document.write("<br>正在安装证书...");
try{
var certEnroll=document.getElementById("objCertEnrollClassFactory");
var objEnroll=certEnroll.CreateObject("X509Enrollment.CX509Enrollment");
var cer=document.getElementById("sPKCS7").innerText;
objEnroll.Initialize(1);
objEnroll.InstallResponse(4,cer,6,"");
document.write("<br>证书安装成功!");
}catch(ex){
document.write("<br><font color='red'>"+ex.description+"</font>");
return false;
}
return true;
}
installCertForWin7();
</script>
This is my HTML page.<br>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment