IE兼容性设置 applet 注册表

1、页面弹框

<a style=" font-size: 11px; font-weight: normal; font-style: normal; text-decoration: none; color: rgb(51, 51, 51);" 
   class="2" οnclick="window.showModalDialog('<%=request.getContextPath()%>/inc/applet.jsp','','dialogHeight:200px;dialogWidth:400px;center:yes');">
   <%=UtilTools.getLabelResource("LABEL_APPLET", currentLocale)%>
  </a>


2、弹出页面

主要applet 可以用object标签

<script type="text/Jscript" src="<%=contextPath%>/js/jquery-1.9.1.min.js"></script>
<script language="javascript">
function viewResult(message)
{
 $("#msg").append("<br>"+message);
}
</script>
</head>
<body>
<div id="msg">登录问题解决程序加载中,请等待...</div>

<applet archive="<%=contextPath%>/inc/ieBrowserEmulationApplet.jar"
 code="com.huawei.IeBrowserEmulationApplet.class"
 name="IeBrowserEmulationApplet" align="middle" width="0" height="0">
 <param name="jnlp_href" value="
 <%=contextPath%>/inc/ieBrowserEmulationApplet.jnlp"> 
 <param name="permissions" value="all-permissions" />
 </applet>
</body>

3、ieBrowserEmulationApplet.jar


-----------inc/ieBrowserEmulationApplet.jar

ieBrowserEmulationApplet.jar文件目录
--ieBrowserEmulationApplet
----src
----IE BrowserEmulation.reg

IE BrowserEmulation.reg
=============begin=================================
 Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation]
"AllSitesCompatibilityMode"=dword:00000001
===============end===============================
IeBrowserEmulationApplet.java
=============begin=================================
public class IeBrowserEmulationApplet extends Applet {
 private static final long serialVersionUID = 1L;

 public void init() {
  exeJs("viewResult('登录问题解决程序执行中,请等待...')");
  exec();
 }

 public void exec() {
  if (RegeditUtil.query()) {
   if (RegeditUtil.setIeEmulation()) {
    System.out.println("登录问题已解决,请重启IE浏览器后生效!");
    exeJs("viewResult('登录问题已解决,请重启IE浏览器后生效!')");
   } else {
    System.out.println("解决登录问题失败,请重试!");
    exeJs("viewResult('解决登录问题失败,请重试!')");
   }
  } else {
   System.out.println("当前系统无登录问题,无需执行此程序!");
   exeJs("viewResult('当前系统无登录问题,无需执行此程序!')");
  }
 }

 private String exeJs(String functionCmd) {
  System.out.println(functionCmd);
  String result = null;
  JSObject jsObj = JSObject.getWindow(this);//
  if (jsObj != null) {
   result = (String) jsObj.eval(functionCmd);
  }
  return result;
 }
}
=============end=================================

------------util/RegeditUtil.java
文件内容
=============begin=================================
public final class RegeditUtil {
//CMD查询注册表IE浏览器访问模式命令
private static String CMD_QUERY = "reg query \"HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\BrowserEmulation\" /v AllSitesCompatibilityMode";
//执行设置注册表IE浏览器访问模式REG脚本
private static String CMD_IMPORT = "reg import \""+System.getProperty("user.dir")+"/IE BrowserEmulation.reg\"";

private static String VALUE = "0x0";

public static boolean query() {
 BufferedReader bufferedReader = null;

 boolean flag = true;
 try {
  Process process = Runtime.getRuntime().exec(CMD_QUERY);
  bufferedReader = new BufferedReader(new InputStreamReader(process
    .getInputStream()));

  String line = null;
  while ((line = bufferedReader.readLine()) != null) {
   System.out.println(line);

   if (!"".equals(line)) {
    flag = false;

    if (line.endsWith(VALUE)) {
     return true;
    }
   }
  }
  return flag;
 } catch (IOException e) {
  System.err.println(e);
 } finally {
  if (bufferedReader != null) {
   try {
    bufferedReader.close();
   } catch (Exception e) {
    System.err.println(e);
   }
  }

 }
 return false;
}

4 、项目

--testPRO
------webroot
-----------js/jquery-1.9.1.min.js
-----------inc/ieBrowserEmulationApplet.jnlp
ieBrowserEmulationApplet.jnlp
=============begin=================================
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="ieBrowserEmulationApplet.jnlp">
    <information>
        <title>IeBrowserEmulationApplet</title>
        <vendor>IeBrowserEmulationApplet</vendor>        
        <offline-allowed/>
    </information>
    <resources>
        <!-- Application Resources -->
        <j2se version="1.6+" href=
           "http://java.sun.com/products/autodl/j2se"/>
        <jar href="ieBrowserEmulationApplet.jar"
            main="true" />

    </resources>
    <applet-desc name="IeBrowserEmulationApplet"           
    main-class="com.huawei.IeBrowserEmulationApplet"           
    <!-- Overwritten by the surrounding web page -->           
    width="1"            
    height="1">       
 </applet-desc> 
 <update check="background"/>
 <security><all-permissions/></security>
</jnlp>
===============end===============================


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值