最近项目需要,做了cab的读卡程序,在本机写一个静态的html文件把cab文件写入能够使用,但把它放到服务器上就通过地址访问就提示失败,郁闷,兄弟姐妹们帮帮忙,这个是本地静态html内容:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<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">-->    <script> 
function myplay()
{ var str= myact.Medicard_GetCardNo(1);
alert(typeof str);
 alert(str);
}
  
  </script>
 
</head><body onload="myplay();">
<OBJECT
      classid="clsid:01C07B92-6535-48A7-A2CE-015E34CC7DF7"
      codebase="F:\安吉读卡\MediCard\AJDK.cab"
      width="690"
      height="455"
      align="center"
      hspace="0"
      vspace="0"
      id="myact";
>
</OBJECT>
  <body>
    This is my HTML page. <br>
  </body>
</html>把这个cab放到 tomcat下面工程目录下面 也就是webroot/public/public/ReadCard/AJDK.cab,然后,写的页面是这个样子:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<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">-->    <script> 
function myplay()
{ var str= myact.Medicard_GetCardNo(1);
alert(typeof str);
 alert(str);
}
  
  </script>
 
</head><body onload="myplay();">
<OBJECT
      classid="clsid:01C07B92-6535-48A7-A2CE-015E34CC7DF7"
      codebase="http//127.0.0.1:8888/SHIS/public/ReadCard/AJDK.cab"
      width="690"
      height="455"
      align="center"
      hspace="0"
      vspace="0"
      id="myact";
>
</OBJECT>
    This is my HTML page. <br>
  </body>
</html>
但就是不成功,不知道是为什么,签名也有了,本地信任地址也有了

解决方案 »

  1.   

    codebase="F:\安吉读卡\MediCard\AJDK.cab" 改成 codebase="MediCard\AJDK.cab" 即服务器目录地址
      

  2.   

    http//127.0.0.1:8888/SHIS/public/ReadCard/AJDK.cab
    直接在ie里面敲这个地址,看能访问不?是否提示下载?
      

  3.   

    用 CMD 看一下  download files 目录下有没有隐藏的文件以及文件夹,我曾经在开发机上测试 把download files 弄乱过,你删掉所有和你控件相关的 隐藏文件夹,重新下载一下试试
      

  4.   

    codebase="http//127.0.0.1:8888/SHIS/public/ReadCard/AJDK.cab" 
    这个地址应该改成和你的HTML页面文件所在的相对路径~~